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.plist
file. 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.plist
keyDescription GIDClientID
OAuth client ID GIDServerClientID
Server OAuth client ID for backend authentication GIDHostedDomain
Google Workspace domain GIDOpenIDRealm
OpenID 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
serverClientID
to enable server-side API access for your app,serverAuthCode
will now be returned withGIDSignInResult
in your completion.Properties from
GIDAuthentication
have 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.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 ofsignInWithConfiguration:presentingViewController:callback:
.Move the logic from
signIn:didDisconnectWithUser:withError:
to the callback block ofdisconnectWithCallback:
.
Manually connect
GIDSignInButton
to a method that callssignInWithConfiguration:presentingViewController:callback:
using anIBAction
or similar.