Google Drive Android API returns success even after removing the app

时光毁灭记忆、已成空白 提交于 2019-12-10 03:05:44

问题


I'm using the new Google Drive Android API. This is the demo code that I've copied from Google's android-samples repo.

GoogleSignInAccount signInAccount = GoogleSignIn.getLastSignedInAccount(this);
if (signInAccount != null && signInAccount.getGrantedScopes().containsAll(requiredScopes)) {
            initializeDriveClient(signInAccount);
}
else 
{ ... }

The issue I'm facing is, even if I remove the app from Drive, getLastSignedInAccount() is still returning the account and the operations (such as adding a file) on the accounts are still succeeding. Returning the GoogleSignInAccount object is fine, I suppose, but it should not allow the operations on it. I double checked in Drive, there are no files getting added when the API returns success (since I've unlinked the app). What is going wrong here?

And yes it worked when I manually synced the account on my device. In that case, though getLastSignedInAccount() returned the object, the operations did fail.

PS: I'm requesting SCOPE_FILE and SCOPE_APPFOLDER scopes.


回答1:


This looks like the desired behaivour.

Only after the sync, will the GoogleSignIn.getLastSignedInAccount(this) get to know, not before that. As you can see, this method is non-blocking.

As an improvement, the API calls for performing operations should return something like a 403 UNAUTHORIZED



来源:https://stackoverflow.com/questions/50319379/google-drive-android-api-returns-success-even-after-removing-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!