Shikha Sharma Shikha Sharma - 1 year ago 69
iOS Question

log in with google account,using email and then creating password for app iOS

I am new in iOS development and I want to use Google login in my app where email is taken from Google account but the password is created for the app and creates new account for the app and stores it on server. How to do this ?

Answer Source

Following is steps to Get Email from Google Sign in :

Step 1 : Use Pod pod 'Google/SignIn

Step 2: Add GIDSignInUIDelegate

Step 3: on Load of Login View or Screen where you want e-mail


Step 4: Implement delegate methods of GIDSignIn

            func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!,
            withError error: NSError!) {

            if (error == nil) {
                // Perform any operations on signed in user here.
                //let userId = user.userID                  // For client-side use only!
                //let idToken = user.authentication.idToken // Safe to send to the server

                let name =
                let email =

                // [START_EXCLUDE]
                // [END_EXCLUDE]
            } else {
                // [START_EXCLUDE silent]
                // [END_EXCLUDE]

Step 5: Use Get email Address in your Login View as pre-filled and add other fields as per you requirement e.g Password , Confirm Password, Contact Number, etc..

Note : you can also use currentUser object from GIDSignIn shared Instance.


Hope this helps you.

do let me know if you have any query.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download