Google 驱动 REST API 注销
Google drive REST API sign out
我使用 Google 驱动器 REST API。然后我像 this guide
那样进行授权程序
我应该如何以编程方式为用户选择的帐户创建 "Sign out"?以至于我的应用程序已经从浏览器中 Google Drive 中的授权应用程序列表中消失了。
基于此 documentation,您可以让您的用户退出您的应用程序,并完全断开他们的帐户与您的应用程序的连接。
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.
您可以通过调用 revokeAccess
方法取消用户帐户:
private void revokeAccess() {
Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// ...
}
});
}
在结果回调中,您可以响应事件并触发应用或后端代码中的任何适当逻辑。在调用 revokeAccess
.
之前,您还必须确认 GoogleApiClient.onConnected
已被调用
检查这个相关的SO question。
我使用 Google 驱动器 REST API。然后我像 this guide
那样进行授权程序我应该如何以编程方式为用户选择的帐户创建 "Sign out"?以至于我的应用程序已经从浏览器中 Google Drive 中的授权应用程序列表中消失了。
基于此 documentation,您可以让您的用户退出您的应用程序,并完全断开他们的帐户与您的应用程序的连接。
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.
您可以通过调用 revokeAccess
方法取消用户帐户:
private void revokeAccess() {
Auth.GoogleSignInApi.revokeAccess(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// ...
}
});
}
在结果回调中,您可以响应事件并触发应用或后端代码中的任何适当逻辑。在调用 revokeAccess
.
GoogleApiClient.onConnected
已被调用
检查这个相关的SO question。