jeudi 13 octobre 2016

How to exchange OAuth2 authorization codes for access tokens received from a client (Ember) in Express?

I'm using ember-simple-auth and torii to handle client-side OAuth2 authentication against Facebook and Google in an Ember app I'm building. I receive an authorization code from that process.

I want to send that code from the client to my REST API and exchange them for access tokens to get their user ID so I can figure out what information they should have access to.

Then, I want to put the user ID into a JSON web token that the client can send me in subsequent requests for data from the BE app.

My Problem: All examples I've found of using Passport for OAuth2 authentication rely on redirecting the user on the server side and using callbacks rather than just exchanging an already-provided authorization code.

What am I missing? This seems like something many apps would need to do.




Aucun commentaire:

Enregistrer un commentaire