简体   繁体   中英

Google drive REST API sign out

I use Google Drive REST API. And I make authorization procedure like in this guide

How I should make "Sign out" for user selected account programmatically ? So that my application has disappeared from the list of authorized applications in Google Drive in the browser.

Based from this documentation , you can enable your users to sign out of your app, and to disconnect their accounts from your app entirely.

It is highly recommended that you provide users that signed in with Google the ability to disconnect their Google account from your app. If the user deletes their account, you must delete the information that your app obtained from the Google APIs.

You can disconnect user's account by calling the revokeAccess method:

private void revokeAccess() {
    Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
            new ResultCallback<Status>() {
                @Override
                public void onResult(Status status) {
                    // ...
                }
            });
}

In the result callback, you can respond to the event and trigger any appropriate logic in your app or your back-end code. You must also confirm that GoogleApiClient.onConnected has been called before you call revokeAccess .

Check this related SO question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM