AI-generated Key Takeaways
-
This page details key changes for major versions of the Google Sign-In SDK and provides a guide to migrate your app.
-
For v7.0.0+, OAuth client configuration is recommended in
Info.plist, scope requests moved toGIDGoogleUser, and several method calls have been updated. -
For v6.0.0, update
sharedInstancecalls, move client configuration toGIDConfiguration, update method calls, and removeGIDSignInDelegatereferences.
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 and the repository on GitHub 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.plistfile. You can continue to set it at runtime (using aGIDConfiguration) object, but this is no longer recommended. See the get started guide for examples and more details.Info.plistkeyDescription GIDClientIDOAuth client ID GIDServerClientIDServer OAuth client ID for backend authentication GIDHostedDomainGoogle Workspace domain GIDOpenIDRealmOpenID 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 has completed.If you are setting
serverClientIDto enable server-side API access for your app,serverAuthCodewill now be returned withGIDSignInResultin your completion.Properties from
GIDAuthenticationhave moved intoGIDGoogleUser.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 toGIDSignIn.sharedInstanceproperty accesses.Move all client configuration (client IDs, etc.) to a
GIDConfigurationobject.Update calls to removed methods to their new equivalents:
v5.x.x v6.0.0 signInsignInWithConfiguration:presentingViewController:callback:restorePreviousSignInrestorePreviousSignInWithCallback:disconnectdisconnectWithCallback:getTokensWithHandler:doWithFreshTokens:refreshTokensWithHandler:doWithFreshTokens:Remove all references to the
GIDSignInDelegateprotocol and its methods.Move the logic from
signIn:didSignInForUser:withError:to the callback block ofsignInWithConfiguration:presentingViewController:callback:.Move the logic from
signIn:didDisconnectWithUser:withError:to the callback block ofdisconnectWithCallback:.
Manually connect
GIDSignInButtonto a method that callssignInWithConfiguration:presentingViewController:callback:using anIBActionor similar.