Google OAuth2 Authorizing OAuth token error: redirect_uri_mismatch

后端 未结 11 1793
青春惊慌失措
青春惊慌失措 2020-11-30 06:59

I am Creating and Authorizing an OAuth Token according to this webpage: https://code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough

But I got this

相关标签:
11条回答
  • 2020-11-30 07:20

    For my native app, I tried dozens of different things. I finally got it to work by using "redirect_uri=http%3A%2F%2Flocalhost%3A1234" where 1234 is the port number. This has to be identical in the two requests (authorization code and the access token). Notice the use of percent encoding.

    0 讨论(0)
  • 2020-11-30 07:22

    Lost 4 or 5 hours with this... use 'postmessage' as parameter value, not the real Redirect Uri...

    $client->setRedirectUri('postmessage');
    
    0 讨论(0)
  • 2020-11-30 07:24

    When you register your app at https://code.google.com/apis/console and make a Client ID, you get a chance to specify one or more redirect URIs. The value of the redirect_uri parameter on your auth URI has to match one of them exactly.

    0 讨论(0)
  • 2020-11-30 07:30

    Just in case if you're using Google+ javascript button (with web application), you have to put postmessage instead of actual URI. It takes me almost whole day to figure out this, because Google docs doesn't clearly stand it for some reason.

    0 讨论(0)
  • 2020-11-30 07:30

    Please note that the 'redirect_uri' value of the Token request need to be the same as the 'redirect_uri' value of the Authorization request.

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