Add Google Sign-In to Your iOS or macOS App

A basic integration only takes a few steps. First, set up a project in the Google API console.
Then, add a GIDSignInButton
to your layout.
Finally, connect the button (using an IBAction
or similar)
to a method that calls
signInWithConfiguration:presentingViewController:callback:
.
Swift
GIDSignIn.sharedInstance.signIn( with: signInConfig, presenting: self ) { user, error in guard error == nil else { return } guard let user = user else { return } // Your user is signed in! }
Objective-C
[GIDSignIn.sharedInstance signInWithConfiguration:signInConfig presentingViewController:self callback:^(GIDGoogleUser * _Nullable user, NSError * _Nullable error) { if (error) { return; } if (user == nil) { return; } // Your user is signed in! }];
To this basic integration, you can add features such as back-end authentication and OAuth 2.0 authorization for accessing Google APIs.
Ready to learn more?
Learn how to get started with our developer's guide. Or, visit our GitHub repository to see some sample code, submit a bug report or feature request, or contribute a pull request.