I am new to oauth 2.0. What i am trying to achieve is following

  • I have a google api based oauth authentication in place
  • On top I fetch the gmail email address and verify if this address is present in my company database or not, based on that I give access to the user to the application. First question, if this approach can be considered as a version of authentication or is it still authorization? (or just a hack!!)
  • Now i need to have a oauth login based on stackexchange api
  • I am at a point where I can fetch the access token with each calls,Next question, now is it possible to fetch the user details like username or registered email id
  • so I can validate if this user should be given access to my app or not even if he has a valid open Id.

Thank you in advance. I am puzzled with this for few days now, some suggestion will be helpful.

  • You can get the username, but not any "email id" or email address. Authenticating with the Google API does not give you authorization with the Stack Exchange API, but you may not need this. (You can use Google credentials to authenticate with the SE API, but that's not the same thing.) ... The question is unclear, give a concrete example of what you are trying to do. – Brock Adams Sep 25 '17 at 2:26
  • Ok, my bad. I will try to break down the question to the parts. To begin with I need to fetch the username and registered email(if it was possible) based on the oauth 2.0 implementation of stack exchange api. – Haramoz Sep 25 '17 at 2:35
  • I am able to fetch the access token now following the instructions from api.stackexchange.com/docs/authentication How do I fetch the user details now, first point where i am stuck. I am not sure about the uri to request OAuthBearerClientRequest like the one for facebook is "graph.facebook.com/me" which is the one for stackexchange? This is the part of the flow where i am stuck. Please let me know if this question is bit more clear now. Thank you for your reply. :D – Haramoz Sep 25 '17 at 2:41
up vote 1 down vote accepted

You can do this using the /me endpoint or the /me/associated endpoint.

/me

Returns the user associated with the passed access_token.

Use this if you want to get user info for a specific site (e.g. StackOverflow).

/me/associated

Returns all of a user's associated accounts, given an access_token for them.

Use this if you want to get user info for all sites that user is registered on.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .