In my app I need to request the Drive API v3 restricted Scope DRIVE.
I managed to build the request Email SignInOption, but when it gets to the Scope request it just freezes on the loading page. I have tried with multiple types of scopes but it still doesnt work. If I take out the requestScopes part it works perfectly
This is my code to request the sign in
// Request Google Sign In to user
public void requestSignIn () {
Log.i("UploadFileActivity", "requestUserSignIn");
GoogleSignInOptions signInOptions = new GoogleSignInOptions
.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(new Scope(DriveScopes.DRIVE))
.requestEmail().build()
// it prints thi, but still doesnt request the scopes
Log.i("UploadFileActivity", "requestUserSignIn");
GoogleSignInClient client = GoogleSignIn.getClient(this, signInOptions);
startActivityForResult(client.getSignInIntent(), 2);
}
This is my gradle
// drive api dependencies
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.api-client:google-api-client-android:1.26.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'pub.devrel:easypermissions:0.3.0'
implementation 'com.google.android.gms:play-services-drive:17.0.0'
implementation 'com.google.api-client:google-api-client:1.30.10'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
Does someone knows what might be causing this error?
EDIT: I've seen there is a track report about an issue very like this: https://issuetracker.google.com/issues/178183308
Finally found the answer! In the Google API console, just simply remove the consent screen from the test state and publish it
Got it from: https://stackoverflow.com/a/65900011/14990708