Google Login

Estimated reading: 3 minutes 221 views
  • Start Integrating Google Sign-In into Your Android App 
  • After this click on Create Project link to create a new project.
  • Enter Project Name and click on Create button.
  • Select the project from the dropdown menu beside Android.
  • Add Package name from your AndroidManifest.xml file, and SHA-1.
  • Click on APIs & Services then click on +ENABLE APIS AND SERVICES.
  • Search for Google+ and enable Google+ API.
  • Once enabled, click on Credentials, on the top nav-bar, click on +Create credentials then click on the API key
  • Select Application restrictions  Android apps with Package name from your AndroidManifest.xml file, and SHA-1.
  • Select API restrictions specify the enabled APIs that this key can call
  • Grab the key and Click Save.

 

  • Once enabled, click on Credentials, on the top nav-bar, click on +Create credentials then click on Oauth client ID
  • In OAuth consent screen page, choose External, fill the form and click Save and Continue.
    • In Authorized domains section, make sure to add your own domain name with or without www.
  • On the next page, you’ll see the button Add or remove scopes, click on it.
    • Look for auth/userinfo.email and select it.
    • Look for auth/userinfo.profile and select it.
    • Scroll down and click on UPDATE.
  • If you successfully added the new scopes, click on SAVE AND CONTINUE.
  • Ignore the Test users section and click on SAVE AND CONTINUE.
  • Scroll down and click on BACK TO DASHBOARD.
  • On the next page, click on PUBLISH APP and publish your application.
  • On the left nav bar, click on Credentials, on the top nav-bar, click on +Create credentials then Oauth client ID
    • In Application type, choose web application.
    • In Authorized redirect URIs, add the following URIs:
      1. https://yourwebsite.com/login-with.php?provider=Google
      2. https://www.yourwebsite.com/login-with.php?provider=Google
  • Finally, go to the file analytic.xml add the key as below:
  • Also, add Client ID in your AppSettings.cs class file in your solution code as below:
Note

You can activate and deactivate your app by setting the variable ShowGoogleLogin.

Info

By integrating Smart Lock for Passwords into your Android app, you can automatically sign users into your app using the credentials they have saved.

You can activate and deactivate your AppSettings.cs class file in your solution code EnableSmartLockForPasswords.

For more details, you can see the video

Leave a Comment