mardi 3 octobre 2017

redirect_uri_mismatch error when enabling server side access

I have an android app with a python server. I need the server to have access to the users' emails constantly, so I'm following this guide:

http://ift.tt/1ErVL7E

def google_api(auth_token):
    # If this request does not have X-Requested-With header, this could be a CSRF
    #if not request.headers.get('X-Requested-With'):
        #abort(403)

    # Set path to the Web application client_secret_*.json file you downloaded from the
    # Google API Console: http://ift.tt/1MwqFt7
    CLIENT_SECRET_FILE = 'secret.json'

    # Exchange auth code for access token, refresh token, and ID token
    credentials = client.credentials_from_clientsecrets_and_code(
        CLIENT_SECRET_FILE,
        ['http://ift.tt/1lIF7p7', 'profile', 'email'],
        auth_token)

    print credentials
    return credentials.id_token

I get the following error: FlowExchangeError: redirect_uri_mismatch

Here is the secret.json:

{"web":{"client_id":"REDACTED",
"project_id":"REDACTED",
"auth_uri":"http://ift.tt/IlrJzQ",
"token_uri":"http://ift.tt/IlrJjr",
"auth_provider_x509_cert_url":"http://ift.tt/1cVKuvL","client_secret":"REDACTED",
"redirect_uris":["http://localhost:8080/"],
"javascript_origins":["http://localhost:8080"]}}

I've also tried using http://ift.tt/2xSB0kE for the redirect_uris and it still returns the same error.

I don't understand what redirect_uris is supposed to be or mean? It's not mentioned in the guide I link at the top




Aucun commentaire:

Enregistrer un commentaire