Search code examples
androidoauthaccountmanager

How to revoke the permission that my app get from user's google gmail AccountManager.getAuthToken(


Created a test app using Eclipse to get the authToken from one of my google e-mail accounts on my device.

Executing this prompted me with the allow access dialog where i press allow access:

accountManager.getAuthToken(account,"oauth2:https://www.googleapis.com/auth/userinfo.profile", false, new GetAuthTokenCallback(), null);

I wanted to create a chooser dialog that works from API8 and up where the user can choose what google account he allow me to access. To do this i have to revoke the permission to see the screen again.

should i see my test app on this page or not?
Authorized Access to your Google Account

I have search for a way to revoke the permission and non is working..
Only thing working is to create a new app project.

UPDATE 2013
Using the Google Play service GCM and this is working ok


Solution

  • Regarding the "Authorized Access to your Google Account" page, you will not see your app there as this permission is a device local permission stored in a database on the phone.

    It does not seem like it is possible to revoke this permission in an easy way. I've been able to find a couple of ways to be able to trigger the dialog again, but none are ideal. In some of these solutions it's not the exact same dialog that is shown, but it might be close enough for testing purposes depending on what you want to do:

    Internally the getAuthToken method keeps track of if access has been granted or not using the UID of the application. So if you are able to somehow force Android to give your app a new UID or to force it to clear the database of given grants the dialog should be shown again. Here are some solutions that others say work for them but that doesn't work for me (maybe it depends on which phone you use?):

    As a side note as revoke permissions to access google auth tokens mention there are internal Android methods for revoking access, but these are not accessible via the public API.