lucj / sails-oauth2-api

140 stars 34 forks source link

Accessing User Data #10

Closed mcnamee closed 9 years ago

mcnamee commented 9 years ago

Hi, Once I've authenticated via token exchange, within Sails, how can I access the current user's _id or email address? Eg. is it saved in a session?

gridpocketuser commented 9 years ago

Hi mcnamee, in the oauthBearer.js policy, the user retrieved is added in the request (req.user = user).

mcnamee commented 9 years ago

Thanks @gridpocketuser I realised I wasn't covering the routes in question with oauth2 - once I did that I can access user credentials with req.user