What is the best way to manage authentication in a Meteor+React application? I know I can use accounts-ui + accounts-password, but I get Blaze in the middle of this which is not something I’d like to. I’ve found this package named accounts-react from a previous post, but I don’t know how reliable it is.
Any suggestions?
If you are going to build your own. I would suggest using Higher order components to keep track of the user state. This can be a combination of using Meteor’s own withTracker HOC and returning it with Meteor.userId()
For login you just have to call Meteor.loginWithPassword(values.userName, values.password, callback (err) { });
For checking if the client is a logged user, use Meteor.user() and pass it to component throug container.
Hey @mortsoudain,
So your suggestion is to keep using accounts-password and develop the UI from scratch, right?
Yes thats for sure, but it would be nice to have a react material package that fits on top ofcourse
Yep, is not a hard component to build. Just 2 input text, one button to call Meteor.loginWithPassword and a prop attached to Meteor.user() to know if you have to render the login component or authorized content component.