# Google Sign-In quick migration guide

This page details key changes for major versions of the Google Sign-In SDK.

Follow this guide to migrate your app to the latest version of the Google
Sign-In SDK. Note that the documentation always refers to the most recent
version.

Also refer to the [release notes](https://developers.google.com/identity/sign-in/ios/release) and the
[repository on GitHub](https://github.com/google/GoogleSignIn-iOS)
for more information.

## Google Sign-In SDK v7.0.0+

To migrate your app from a version of the Google Sign-In SDK prior to v7.0.0,
make the following changes:

- Set your OAuth client configuration in your application's `Info.plist` file.
  You can continue to set it at runtime (using a `GIDConfiguration`) object,
  but this is no longer recommended. See the [get
  started](https://developers.google.com/identity/sign-in/ios/start-integrating#configure_app_project) guide for
  examples and more details.

  | `Info.plist` key | Description |
  |---|---|
  | `GIDClientID` | [OAuth client ID](https://developers.google.com/identity/sign-in/ios/start-integrating#add_client_id) |
  | `GIDServerClientID` | [Server OAuth client ID for backend authentication](https://developers.google.com/identity/sign-in/ios/start-integrating#add_server_client_id) |
  | `GIDHostedDomain` | [Google Workspace domain](https://developers.google.com/identity/sign-in/ios/start-integrating#add_domain_realm) |
  | `GIDOpenIDRealm` | [OpenID realm](https://developers.google.com/identity/sign-in/ios/start-integrating#add_domain_realm) |

- The `addScopes:` method has been moved to GIDGoogleUser. Instead of
  requesting additional authorization scopes from GIDSignIn, you should now
  [request them from GIDGoogleUser after authentication](https://developers.google.com/identity/sign-in/ios/api-access#2_request_additional_scopes)
  has completed.

- If you are setting `serverClientID` to [enable server-side API access for
  your app](https://developers.google.com/identity/sign-in/ios/offline-access), `serverAuthCode` will now be
  returned with `GIDSignInResult` in your completion.

- Properties from `GIDAuthentication` have moved into `GIDGoogleUser`.

- Update method calls:

| v6.2.x | v7.0.0+ |
|---|---|
| `GIDSignIn` `signInWithConfiguration:presentingViewController:callback:` | `GIDSignIn` `signInWithPresentingViewController:completion:` |
| `GIDSignIn` `restorePreviousSignInWithCallback:` | `GIDSignIn` `restorePreviousSignInWithCompletion:` |
| `GIDSignIn` `disconnectWithCallback:` | `GIDSignIn` `disconnectWithCompletion:` |
| `GIDAuthentication` `doWithFreshTokens:` | `GIDGoogleUser` `refreshTokensIfNeededWithCompletion:` |
| `GIDSignIn` `addScopes:presentingViewController:callback:` | `GIDGoogleUser` `addScopes:presentingViewController:completion:` |

## Google Sign-In SDK v6.0.0

To migrate your app from a version of the Google Sign-In SDK prior to v6.0.0,
make the following changes:

- Update all `[GIDSignIn sharedInstance]` calls to `GIDSignIn.sharedInstance`
  property accesses.

- Move all client configuration (client IDs, etc.) to a `GIDConfiguration`
  object.

- Update calls to removed methods to their new equivalents:

  | v5.x.x | v6.0.0 |
  |---|---|
  | `signIn` | `signInWithConfiguration:presentingViewController:callback:` |
  | `restorePreviousSignIn` | `restorePreviousSignInWithCallback:` |
  | `disconnect` | `disconnectWithCallback:` |
  | `getTokensWithHandler:` | `doWithFreshTokens:` |
  | `refreshTokensWithHandler:` | `doWithFreshTokens:` |

- Remove all references to the `GIDSignInDelegate` protocol and its methods.

  - Move the logic from `signIn:didSignInForUser:withError:` to the callback
    block of `signInWithConfiguration:presentingViewController:callback:`.

  - Move the logic from `signIn:didDisconnectWithUser:withError:` to the
    callback block of `disconnectWithCallback:`.

- Manually connect `GIDSignInButton` to a method that calls
  `signInWithConfiguration:presentingViewController:callback:` using an
  `IBAction` or similar.