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.
- (IBAction)didTapDisconnect:(id)sender { [[GIDSignIn sharedInstance] disconnect]; }
- (void)signIn:(GIDSignIn *)signIn didDisconnectWithUser:(GIDGoogleUser *)user withError:(NSError *)error { // Perform any operations when the user disconnects from app here. // ... }
The didTapDisconnect
method signs out the user in addition to disconnecting
and revoking tokens. You must not sign out the user prior to calling
didTapDisconnect
.
You can trigger the above didTapDisconnect
method from a button that you add to your
app. You can then respond to the successful disconnection within the
didDisconnectWithUser
method and trigger any appropriate logic in your app or
your back-end code.