User Authentication using external API + React


I’m new to Meteor and I recently started an App using it and React but I already get stucked.
Unfortunately I’m not using the awesome Meteor.user colection because I don’t know how to correctly implementing itwith this kind of App.

Basically the App has a login page and not a registration page. The authentication must be done through an external API and it respond with a user id and a token and I should use that token for all next API queries and I also should use the user id to for page authorizations.

What I tried to do so far is to use Meteor.user collection creating server side the account as soon as the API respond with status 200, so that I can store the token in there and use Meteor.userId() along the App for authorization purposes. Unfortunately I discovered I can not log in from the server… So I don’t know how to apply this solution.

I tried creating a totally new collection but here the issue is different… When successfully logged in I don’t know how to propagate the current user along the App.

It would be really nice if you can give me an hint how to achieve it.
I’m also open to hire a dev for one hour helping me understanding this part if someone is up to.


What kind of API? An OAuth API?

The user accounts system is extendable with packages. Some of these are accounts-twitter and accounts-facebook, which are easy to read and understand how they work (IMO), if you ever need to write a custom one.

Check out on atmosphere if there isn’t already a package for the API you’re using.