Search code examples
c#.netgoogle-apigoogle-drive-apigoogle-oauth

How to disconnect (remove access) of google drive using Google.Apis.Drive.V3?


I have successfully connected in google drive using apis.drive.v3 and also get the file details, then perform the actions like upload, download and delete as well.

Now the user wants to remove access of google drive from my application itself, without go to google accounts (Security - Apps with access to your account - remove access).

How to disconnect (what is the api call for remove access) from my application to clear the access token and refresh token in Google Accounts?


Solution

  • You can use the credential to revoke the access the user has granted you.

    credential.RevokeTokenAsync(CancellationToken.None);