Ошибка redirect_uri_mismatch при включении доступа на стороне сервера к Google API ⇐ Android
-
Anonymous
Ошибка redirect_uri_mismatch при включении доступа на стороне сервера к Google API
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:
https://developers.google.com/identity/ ... ine-access
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: https://console.developers.google.com/apis/credentials 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, ['https://www.googleapis.com/auth/gmail.readonly', '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":"https://accounts.google.com/o/oauth2/auth", "token_uri":"https://accounts.google.com/o/oauth2/token", "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/ce ... :"REDACTED", "redirect_uris":["http://localhost:8080/"], "javascript_origins":["http://localhost:8080"]}} I've also tried using http://my_actual_domain.com:5000/ 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
Источник: https://stackoverflow.com/questions/465 ... google-api
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:
https://developers.google.com/identity/ ... ine-access
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: https://console.developers.google.com/apis/credentials 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, ['https://www.googleapis.com/auth/gmail.readonly', '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":"https://accounts.google.com/o/oauth2/auth", "token_uri":"https://accounts.google.com/o/oauth2/token", "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/ce ... :"REDACTED", "redirect_uris":["http://localhost:8080/"], "javascript_origins":["http://localhost:8080"]}} I've also tried using http://my_actual_domain.com:5000/ 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
Источник: https://stackoverflow.com/questions/465 ... google-api
Мобильная версия