2

I try to build below:

enter image description here

by following: this steps

and i use oauth playground to generate auth code and load it into my server manually (for testing purpose)

i did put in Authorised redirect URIs : https://developers.google.com/oauthplayground and try to get my auth code this way.

then i load my auth code generated from playground to my REST API Server (http://localhost:5000/api/user/blah) and use this python snippet to exchange the code:

try:
    credentials = client.credentials_from_clientsecrets_and_code(
                  app.config.get('GG_APP_SECRET'),
                  ['https://www.googleapis.com/auth/plus.me', 'profile', 'email'],
                    req_gg_code)
except Exception as e:
    log.info('>>>>> Exception: %s <<<<<', e)
    return generate_response(code=400, error=False, type='Fail', message=str(e))

and the result: i keep receive error:

oauth2client.client - INFO - Failed to retrieve access token: b'{\n "error" : "redirect_uri_mismatch"\n}'

my REST API server doesnt have any interface, it will just receive feed from other client (e.g. mobile app) and it doesnt have any redirect uri.

so what's wrong here? what is the correct configuration of my web client id? at the moment i'm using web client id (type: web application) with redirect uri: https://developers.google.com/oauthplayground

AnD
  • 3,060
  • 8
  • 35
  • 63
  • I can think of 2 possibilities, 1. While requesting auth code what is the redirect uri that you passed? You have to use the same one while requesting access token 2. Are you using the redirect uri which is registered in your google application that you created? – Venkatesh Marepalli Jul 06 '17 at 17:13
  • try following the steps at https://stackoverflow.com/questions/19766912/how-do-i-authorise-an-app-web-or-installed-without-user-intervention-canonic Note that it is much easier to take the Refresh Token from the playground than to take the Auth Code – pinoyyid Jul 07 '17 at 10:44
  • Thanks, but what i'm trying to achieve is actually to get Auth Code - send to my server through rest api and let my server exchange to Access token, now i did try using mobile app as well, and i still keep receiveing Redirect URI missmatch, confusing because in my flow, technically there is no redirect uri / not required redirect uri – AnD Jul 07 '17 at 14:11

0 Answers0