Could not obtain Google oAuth 2 token on POSTMan

前端 未结 3 1022
轻奢々
轻奢々 2021-01-02 05:16

Well, since the Other problem(solved) remain unsolved, I was thinking to use POSTMan to do Trial and Error on each steps that the Client library will do.

So I read t

相关标签:
3条回答
  • 2021-01-02 05:50

    I followed Rajat's instructions, and they worked but afterward I tried what the OP did again but this time setting the scope to 'email' instead of leaving it blank, I got a prompt to enter my gmail creds, and was able to get access token.

    0 讨论(0)
  • 2021-01-02 05:52

    BigHomie's suggestion of scope to 'email' worked for me as well. But I used a different Auth URL and Access Token URL than BigHomie, because I think it's been updated.

    Auth URL: https://accounts.google.com/o/oauth2/auth

    Access Token URL: https://accounts.google.com/o/oauth2/token

    0 讨论(0)
  • 2021-01-02 05:54

    You get access Token only when a Google User Logs in through the google signin page.

    Step 1: Redirect https://accounts.google.com/o/oauth2/auth?client_id=" + GoogleClientID + "&redirect_uri=" + Url.Encode(GoogleRedirectURL) + "&response_type=code&scope=email"

    Step 2: Now you are on google signin page and you would enter your google credentials.

    Step 3 : Google will redirect you back to the redirect_uri that you have configured in the Google Developer Console and you can get the "code" from the QueryString

    Step 4: Now you post a form to https://www.googleapis.com/oauth2/v4/token with client_id, client_secret, redirect_uri, code(you obtained in Step 3), and the grant_type=authorization_code

    Result: You should now receive the access_token from Google

    0 讨论(0)
提交回复
热议问题