Important: Starting
May 1, 2024, Apple
requires Privacy Manifests and signatures for iOS applications that use commonly-used SDKs, including GoogleSignIn-iOS. Upgrade to GoogleSignIn-iOS v7.1.0+ before May 1, 2024. Follow
our upgrade guide.
Revoking access tokens and disconnecting the app
Stay organized with collections
Save and categorize content based on your preferences.
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.
The following code example demonstrates how to programmatically revoke access
tokens that your app was granted on behalf of the user and to disconnect the
user's account from your app.
Swift
GIDSignIn.sharedInstance.disconnect { error in
guard error == nil else { return }
// Google Account disconnected from your app.
// Perform clean-up actions, such as deleting data associated with the
// disconnected account.
}
Objective-C
[GIDSignIn.sharedInstance disconnectWithCompletion:^(NSError * _Nullable error) {
if (error) { return; }
// Google Account disconnected from your app.
// Perform clean-up actions, such as deleting data associated with the
// disconnected account.
}];
The disconnectWithCompletion:
method signs the user out in addition to
disconnecting their account and revoking tokens. You must not sign the user out
before calling disconnectWithCompletion:
.
You can then respond to the successful disconnection within the callback block
and trigger any appropriate logic in your app or your back-end code.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-19 UTC.
[null,null,["Last updated 2025-05-19 UTC."],[[["\u003cp\u003eApps should allow users who signed in with Google to disconnect their Google account.\u003c/p\u003e\n"],["\u003cp\u003eUpon account deletion, app developers must delete user data obtained via Google APIs.\u003c/p\u003e\n"],["\u003cp\u003eProvided code snippets (Swift & Objective-C) show how to revoke access tokens and disconnect a user's Google account.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003edisconnectWithCompletion:\u003c/code\u003e handles sign-out, disconnection, and token revocation - do not sign the user out beforehand.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should implement logic within the callback to handle successful disconnections and trigger necessary actions.\u003c/p\u003e\n"]]],[],null,["# Revoking access tokens and disconnecting the app\n\nIt is highly recommended that you provide users that signed in with Google the\nability to disconnect their Google account from your app. If the user deletes\ntheir account, you must delete the information that your app obtained from the\nGoogle APIs.\n\nThe following code example demonstrates how to programmatically revoke access\ntokens that your app was granted on behalf of the user and to disconnect the\nuser's account from your app. \n\n### Swift\n\n GIDSignIn.sharedInstance.disconnect { error in\n guard error == nil else { return }\n\n // Google Account disconnected from your app.\n // Perform clean-up actions, such as deleting data associated with the\n // disconnected account.\n }\n\n### Objective-C\n\n [GIDSignIn.sharedInstance disconnectWithCompletion:^(NSError * _Nullable error) {\n if (error) { return; }\n\n // Google Account disconnected from your app.\n // Perform clean-up actions, such as deleting data associated with the\n // disconnected account.\n }];\n\nThe `disconnectWithCompletion:` method signs the user out in addition to\ndisconnecting their account and revoking tokens. You must not sign the user out\nbefore calling `disconnectWithCompletion:`.\n\nYou can then respond to the successful disconnection within the callback block\nand trigger any appropriate logic in your app or your back-end code."]]