Try Sign-In for iOS

Use our iOS sample app to see how Sign-In works, or add Sign-In to your existing app.

To use this sample, make sure you have Xcode and CocoaPods.

Get the project

Start with the sample using the following command from a terminal:

pod try GoogleSignIn

CocoaPods will clone the sample project from GitHub and open it in Xcode.

Get an OAuth client ID

Click the button below to create a new Google API project and get an iOS client ID for the project. When prompted, specify as the bundle ID.

Create an OAuth client ID

After you create the OAuth client ID, copy it over the placeholder text in AppDelegate.m:

[GIDSignIn sharedInstance].clientID = @"YOUR_CLIENT_ID";

Set the callback URL type

Before Sign-In can run, you need to set up a URL type to handle the callback. In your Xcode project's Info tab, under the URL Types section, find the URL Schemes box containing the string YOUR_REVERSED_CLIENT_ID. Replace this string with your reversed client ID—your client ID with the order of the dot-delimited fields reversed. For example:


Run the application

Now you're ready to build and run the sample app from Xcode.

Select the SignInExample target then start the sample application on a device or in the iOS simulator by clicking the run button for the workspace.

How it works

Add a GIDSignInButton view to your app in a storyboard, a XIB file, or programmatically. In the app delegate, implement the signIn:didSignInForUser:withError delegate method that will be called when a user taps the sign-in button and completes the sign-in flow.

- (void)signIn:(GIDSignIn *)signIn
didSignInForUser:(GIDGoogleUser *)user
     withError:(NSError *)error {
  if (error != nil) {
    if (error.code == kGIDSignInErrorCodeHasNoAuthInKeychain) {
      NSLog(@"The user has not signed in before or they have since signed out.");
    } else {
      NSLog(@"%@", error.localizedDescription);
  // Perform any operations on signed in user here.
  NSString *userId = user.userID;                  // For client-side use only!
  NSString *idToken = user.authentication.idToken; // Safe to send to the server
  NSString *fullName =;
  NSString *givenName = user.profile.givenName;
  NSString *familyName = user.profile.familyName;
  NSString *email =;
  // ...

Next steps


Add Sign-In to your app
