Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Revoke access granted to my app Google Drive API

How do I revoke access that has been granted to my Google Drive web application so that upon the user's next use he is asked for permissions afresh?

like image 419
Bolutife Ogunsola Avatar asked Aug 18 '12 09:08

Bolutife Ogunsola


2 Answers

In order to revoke the access go to the below url

https://security.google.com/settings/security/permissions?pli=1

Choose your apps that you need to revoke and click on remove.

like image 99
Shiven Ojha Avatar answered Sep 20 '22 05:09

Shiven Ojha


For revoking your access token, you need to "GET" (!) this url: https://accounts.google.com/o/oauth2/revoke?token={token} where {token} is the value of your token, as explained here: https://developers.google.com/accounts/docs/OAuth2WebServer#tokenrevoke

For Java API (don't know for other languages), as of 9th of Sept 2012, there is no API for this. I managed to revoke a token with this code:

class myGoogleApi {
    private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();

    ...

    public revoke(String token) {
        HttpRequestFactory factory = HTTP_TRANSPORT.createRequestFactory();
        GoogleUrl url = new GoogleUrl("https://accounts.google.com/o/oauth2/revoke?token="+token);
        HttpRequest request = factory.buildGetRequest(url);
        HttpResponse response = request.execute();
        ...
    }
like image 42
DenisGL Avatar answered Sep 23 '22 05:09

DenisGL