Integrating GoogleSigin in iOS (Swift)

Save

In iOS we can login into the app through Social account, then we don’t need to fill a long form to register into the app, let’s see below integrating GoogleSigin in iOS (Swift).

GoogleSignIn SDK installation

First, we need to install Google Signin pod.

Here’s how your Podfile should look like:

Creating OAuth client ID for GoogleSignIn

After the SDK installation, you will need an OAuth client ID and an iOS URL scheme so that you can continue with the configuration in Xcode.

Now open Google APIs Console and create a project for your sample app. If you have already created a project, you can also select it from the project list.

After creating a project, we also need to configure the OAuth consent screen. Follow the steps as shown in the image below to choose your app user type and then create the OAuth consent screen.

In the OAuth consent screen information page, fill in the application name, and then click “save”. This application name will be the name being shown in the Google Sign-in form when a user tries to sign in using your app.

After finishing configuring the OAuth consent screen, it’s time to create the OAuth client ID. Please check the below image to navigate to the OAuth client ID creation page.

 

Once you reach the OAuth client ID creation page, go ahead and select “iOS” as application type, fill in the name and also your sample app bundle ID and then click “create”.

 

Copy the OAuth client ID and iOS URL scheme you just created and save them, you will need both of them in just a bit.

GoogleSignIn SDK configuration in Xcode

Step1: Open project in xcode, select target and in Info section add iOS URL scheme in URL Types

Step2: Now, open AppDelegate class and import GoogleSignIn module.

Step3: After that, add below code into application(_:didFinishLaunchingWithOptions:) method.

Step4: Then just after application(_:didFinishLaunchingWithOptions:), add below method

Finally, the GoogleSignIn is implemented in our project, now we can run it and check GoogleSignIn.

As, we can see integrating GoogleSigin in iOS (Swift) is so easy, for more detailed information please check here.

Also check Google Signin implementation in objective-c here.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Swapnil Kada
    how to retrive Users email & name?
    • jitendra kumar (Moderator)
      Hello,Kindly contact us at [email protected]. So that we could assist you in a better way.Thanks
  • css.php

    All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.

    Josh Arnold

    Josh Arnold

    Owner, Shop ATV Escape

    Talk to Sales

    Global

    Live Chat
    Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home