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{erroringuarderror==nilelse{return}// Google Account disconnected from your app.// Perform clean-up actions, such as deleting data associated with the// disconnected account.}
Objective-C
[GIDSignIn.sharedInstancedisconnectWithCompletion:^(NSError*_Nullableerror){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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["Apps should allow users who signed in with Google to disconnect their Google account."],["Upon account deletion, app developers must delete user data obtained via Google APIs."],["Provided code snippets (Swift & Objective-C) show how to revoke access tokens and disconnect a user's Google account."],["`disconnectWithCompletion:` handles sign-out, disconnection, and token revocation - do not sign the user out beforehand."],["Developers should implement logic within the callback to handle successful disconnections and trigger necessary actions."]]],[]]