Im trying to upload image on google drive. The API seems is verified. Since in GCP console I got
Verification Status Verified Your consent screen has been verified. If you make changes that require verification later, you must resubmit your application for review
But after uploading i have exception
com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException
And cause
com.google.android.gms.auth.UserRecoverableAuthException: NeedRemoteConsent
Full exception message
Also faced the same error. When calling a Drive service, you should catch UserRecoverableAuthIOException
, get the intent from it UserRecoverableAuthIOException#getIntent()
and start the intent with startActivityForResult
to show an OAuth2 permission page to user. Then handle a user's choice in onActivityResult
.
try {
// Some call to the Drive
} catch (UserRecoverableAuthIOException e) {
startActivityForResult(e.getIntent(), REQUEST_AUTHORIZATION);
}
You can test it by revoking a permission for your app in your Google Drive settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With