Android Authorize Google Drive Api
I wanted the ability to upload and download from a users Google drive account. Uploading and download works fine, the problem is authorizing the account. So far I was using the and
Solution 1:
It is very likely just a mismatch of you authorization items. For an Android app, the authorization consists of 2 essential items that must be in order in your developers console (OMG, they re-shuffled it again !!!). You don't need the 'client_secret.json'.
- APIs & auth -> Credentials -> Credentials -> Android client 1 'SHA1' MUST BE IN SYNC with your 'Pakage name'
- APIs & auth -> Credentials -> OAuth consent screen MUST have your 'Product Name' and 'Email address'
I'm guessing that by switching to the 'release' version of your app, the 'Package name' / 'SHA1' you are producing are out of sync with the Developers console (your IDE is pointing to a different keystore, thus pulling incorrect SHA1).
Here is the 'last ditch' check I use when I get in trouble.
- Find the APK that's not working. Open the '*.apk' file in an unzipper (7-zip) and find 'META-INF\CERT.RSA' file in the archive. Unzip it, for instance to your desktop
- Run 'keytool -printcert -file .\desktop\CERT.RSA'.
- You should see the 'SHA1' of the APK file. Compare it with the 'SHA1' in the dev console. Check the package name as well (it is in your manifest). The 'Package Name' / 'SHA1' pair is what authorizes the app version in Google Drive.
Good Luck
Post a Comment for "Android Authorize Google Drive Api"