'Android: NEED_REMOTE_CONSENT Service: oauth2: https://www.googleapis.com/auth/drive.file
We have an Android app (minSdkVersion 23
- targetSdkVersion 32
) that is custom build for a customer. It uploads files to their Google Drive. It worked fine for years but recently users are getting error:
W/Auth: [GoogleAccountDataServiceImpl] getToken() -> NEED_REMOTE_CONSENT. App: ...appname.., Service: oauth2: https://www.googleapis.com/auth/drive.file
The User-Type was EXTERNAL and that might need a Consent since we were using Drive (however I think this specific scope is not 'sensitive'). Since it was only used by one customer, just to be sure we created the API (cloud.google.com) with a Google developer-account on the customer's domain and made it INTERNAL. To do this we created a developer-account within the customer's Google Works domain and registered the app with the same SHA1 key (after removing it in the old account).
We have only one non-sensitive scope: .../auth/drive.file
It's description: "See, edit, create and delete only the specific Google Drive files that you use with this app"
Some possible causes I can think of:
- I don't think the problem is the OAuth consent screen, but the OAuth consent screen requires at least one Authorised domains. What should this be in case of an Android app?
- The app's internal name doesn't match the customer's internet domain name. Something like
com.ourname.appname
- Something has changed in Google Drive. We upload to a folder by it's folder-ID. Is this not allowed anymore?
- We are not using the latest code. It always gives a lot of problems if we update to the latest libraries, etc. But I don;t think it's very old neither. Our dependecies:
implementation 'com.android.support:support-v4'
implementation 'com.google.android.gms:play-services:7.8.0'
implementation 'com.google.api-client:google-api-client-xml:1.18.0-rc'
implementation 'com.google.http-client:google-http-client-gson:1.18.0-rc'
implementation 'com.google.api-client:google-api-client-android:1.18.0-rc'
implementation 'com.google.apis:google-api-services-drive:v2-rev167-1.18.0-rc'
What could cause this error?
Solution 1:[1]
It started working after updating the libraries.
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.api-client:google-api-client-xml:1.34.0'
implementation 'com.google.http-client:google-http-client-gson:1.39.2'
implementation 'com.google.api-client:google-api-client-android:1.34.0'
implementation 'com.google.apis:google-api-services-drive:v2-rev20200701-1.30.10'
These updates caused some breaking changes and 'difficult' errors but after I solved them all, it worked again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | roberth |