Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

java - How to remove account information saved from GoogleSignInAccount

I've been following Googles tutorial to integrate Google Sign In functionality into an Android app and I'm at the part where it outlines how to revoke access. I set up their simple example and it runs without error. However, after I revoke access to the account and call a Google Sing In Intent the account is still there. Furthermore, tapping the account signs me back in without any prompts to re-grant permissions or even give my password again. I confirmed that the permission is actually being revoked on googles end. I also confirmed that it gets regranted as well. So I believe something is being saved somewhere on my end.

Calling:

AccountManager accountManager = AccountManager.get(getApplicationContext());

Account account = accountManager.getAccountsByType("com.google");

Returns a populated array. But calling:

Account account = accountManager.getAccountsByType("com.google")[0];

accountManager.removeAccount(account, ...);

Throws this error:

java.lang.SecurityException: uid 10085 cannot remove accounts of type: com.google

From my research this seem to do with not having a custom Authenticator set up? I tried to set up a simple one and I think I did everything necessary but it still doesn't work. It's completely possible that it's just improperly set up and I am willing to keep at it until it works but at this point I am not sure if I am even in the right territory here. I'm new to the Android framework and Java in general so I am sort of learning on the fly. If anybody could steer me in the right direction that would be much appreciated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...