You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
If you are still having issues, please be sure to include as much information as possible:
Environment details
OS type and version: Android 11
Python version: 3.8.1
pip version:
google-auth-oauthlib version: 0.4.5
Steps to reproduce
create a new project in console.cloud.google.com with a desktop oauth credential and a android ouath credential
if using desktop credentials: it works like on my desktop environment, if using android credentials I got a KeyError that informs me that there is no 'client_secret' key and crashes, inspecting the two file it is true, in android client_secret.json provided by google there is no 'client_secret' field, while in desktop one there is.
Code example
thisisthepieceofcodewhereIhandletokenandauthorization, classattributesself.token_fileandself.credentials_fileare :
thetokenfilepath, theclientsecretfilepath# exampledef__token_handle__(self):
"""handles authentication token"""# If modifying these scopes, delete the file token.json.scopes= ['https://www.googleapis.com/auth/drive']
creds=Noneifos.path.isfile(self.token_file):
creds=Credentials.from_authorized_user_file(self.token_file,
scopes)
# If there are no (valid) credentials available, let the user log in.ifnotcredsornotcreds.valid:
ifcredsandcreds.expiredandcreds.refresh_token:
try:
creds.refresh(Request())
exceptRefreshError:
returnNoneelse:
flow=InstalledAppFlow.from_client_secrets_file(
self.credentials_file, scopes)
creds=flow.run_local_server(port=0)
# Save the credentials for the next runwithopen(self.token_file, 'w') astoken:
token.write(creds.to_json())
returncreds# in __init__ I have this lines that calls token_handle and if creds are valid, instantiate the service:def__init__(self):
creds=self.__token_handle__()
ifcredsisNone:
return# The file token.json stores the user's access and refresh tokens, and# is# created automatically when the authorization flow completes for the# first# time.self.service=build('drive', 'v3', credentials=creds)
Stack trace
# example
# stacktrace of KeyError
07-31 14:24:39.218 16209 16335 I python : File "/xxx/.buildozer/android/app/lib/storage
/google_drive.py", line 359, in __token_handle__
07-31 14:24:39.219 16209 16335 I python : File "/xxxx/.buildozer/android/platform/build-
armeabi-v7a/build/python-installs/travel_lint/google_auth_oauthlib/flow.py", line 460, in run_local_server
07-31 14:24:39.220 16209 16335 I python : File "xxxx/projects/holiday/.buildozer/android/platform/build-
armeabi-v7a/build/python-installs/travel_lint/google_auth_oauthlib/flow.py", line 278, in fetch_token
07-31 14:24:39.221 16209 16335 I python : KeyError: 'client_secret'
07-31 14:24:39.221 16209 16335 I python : Python for android ended.
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
If you are still having issues, please be sure to include as much information as possible:
Environment details
google-auth-oauthlib
version: 0.4.5Steps to reproduce
Code example
Stack trace
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
The text was updated successfully, but these errors were encountered: