Search code examples
apiexpressgoogle-oauthpassport.jspassport-google-oauth

Which google oauth playground API should I use to obtain a token with the name, user photo and email?


I found this tool from google recently https://developers.google.com/oauthplayground/ and well I am currently doing an authentication practice for an api with node and passpor.js, I would like to know which of these apis is the one that I should choose to obtain a token with the user, the email and the profile photo, in the tutorial I saw that use https://www.googleapis.com/auth/userinfo.profile, so I don't know if it is depreciated or has been replaced by a new one, or if it is something that can be used in production.

And well also if you could explain a little more about what this tool is, I would appreciate it a lot.


Solution

  • On OAuth Playground you can "input your own scope".

    Copy and paste https://www.googleapis.com/auth/userinfo.profile and click Authorize APIs. Then exchange for an access token.

    After that you can call https://www.googleapis.com/oauth2/v2/userinfo and it should return the data you are looking for.