Google Login Tutorial - Part 2
In previous part of Google Login Tutorials we had just discussed to general idea about how Google Login with OpenID Connect (OAuth 2.0) works. As we mentioned earlier we gone see the whole process step by step, so from here we begin. There are six main steps involved in implementing this whole Google Login process. In this part of tutorial we gone see first two steps.
Step 1: Setting up project in Google Developers Console:
Before our app or website can use Google’s OAuth 2.0 authentication system for user login, we must set up a project in the Google Developers Console to obtain OAuth 2.0 credentials. For doing this follow following steps:
- Go to the Google Developers Console.
- Select a project, or Create a new one and name it.
- In the sidebar on the left, expand APIs & auth. Next, click APIs. In the list of APIs, make sure all of the APIs you are using show a status of ON. For example if our application need to access some features provided by Google such as Google Drive, Google Maps, Google Calendar or any other, then we must select proper API and turn its status to ON.
- In the sidebar on the left, select Credentials.
- If you haven’t done so already, create your project’s OAuth 2.0 credentials by clicking Create new Client ID, and providing the information needed to create the credentials.
- Look for the Client ID and Client secret in the table associated with each of your credentials.
Now Client ID and Client secret are two very important things which we required throughout the implementation so note it down carefully.
Step 2: Setting Up redirected URI.
As we have discussed Redirected URI is the path to the file in our application which will be handling our login. For example http://35.176.198.126/experiments/google-login-example/handle.php
To find the redirect URIs for our OAuth 2.0 credentials, do the following:
- Go to the Google Developers Console.
- Select our project.
- In the sidebar on the left, select Credentials.
- Look for the Redirect URIs row in the appropriate Client ID table.
- You can modify the list of redirect URIs by clicking Edit settings below the table, or by deleting and recreating your credential.
Note that Google allows you to have multiple redirects URI for single project but I recommend you to use only one redirect URI for one application and also create separate project if you are doing multiple applications. This will help you in monitoring application usage for each individual application.
Stay tuned .. Next part of Google Login Tutorial will be made available soon.
Comments
Post a Comment