Google APIs - Google Web Authentication

Google APIs

Google provides a variety of API Services such as Google Cloud APIs, G Suite APIs, Google Map APIs, Mobile APIs, Social APIs. Now, we are going to discuss adding Google Authentication to your website. This will be the flow of the article - 
  • Enabling Google Console API
  • Credentials for OAuth Consent screen
  • Credentials for API key
  • Credentials for API Client ID 
  • Credentials for API Client ID Web Application
  • Credentials for API Client ID Redirect URLs
  • Check your OAuth Working 
Requirements

Google Account or Create new.

Step 1 Enable Google Console API 

Go to the Google API site. After logging to your Google account, click on Dashboard followed by enabling Google API and Services.

 

Step 2 Credentials for OAuth Consent screen

Now, click Credentials >> OAuth Consent screen. Enter your Email ID, product name(that name is Web API Username), logo URL, Homepage URL and click "Save".

 

Step 3 Credential API Keys

Open Credentials menu. Then click Credentials >> Create Credentials >> select API key and wait a few seconds until you get a popup window (that your API key has been created). Then, click "Close".

 

 

Step 4 Credentials for API Client ID

Now, click Create credentials >> OAuth Client ID and wait for a few seconds. OAuth requests the user consent so that your application can access the user data.

 

Select Web Application and enter your name and authorized redirect URLs, then click "Create".

 

The Authorized Redirect URLs can not be public IP address.

Step 5 Credentials API Client ID Web Application

Finally, you have Client ID, Secret, and API key. Now, click OK and remember the API keys are for restricted use only.

 

 

Step 6 Credentials API Client ID Redirect URLs

Click to open OAuth 2.0 client IDs

Afterwards open new Incognito window in Chrome, Copy your Clients ID and Redirect URLs then Paste and run in browser.
  1. https://accounts.google.com/o/oauth2/v2/auth?scope=openid&redirect_uri=
  2. +"Redirect URLs"+
  3. &response_type=code&client_id=
  4. +"Client ID"+

     
Wait a few seconds and enter your google Account as well as password. Next the google server will check your Account and password and after it's OAuthorized it will redirect to your 'Redirect URLs' Web site.



Finally your web OAuth application is created sucessfully.



Conclusion

I hope you learned how to create a Web OAuthentication Application using Google APIs.