
Any application that wants to use Google API, must have to register a Client application in Google to get a Client Id and Client Secret. That application will further use this Client Id and Client Secret to get an Access Token from Google to access its APIs.
In this post, we will understand how to register an application in Google and generate ClientId and Client Secret.
Step1: Go to Google Developer Console - Credential Page, select an existing project, or create a new one.
Step 2: Click Create credentials > OAuth client ID
Step 3: Note: Before you create a client ID, you have to configure a consent screen. Click Configure Consent Screen button.
Step 4: Fill basic information in wizard step 1 - OAuth consent screen.
Step 5: Select all basic scopes - openid
, email
& profile
.
Step 6: For testing, put your email id here. You can add multiple test users here.
Step 7: Finally, go to the Credentials tab again. Select Application Type > Web application and enter a name for the application.
Step 8: Enter the URL of your application where you want Google to redirect post authentication.
Step 9: Hit Create button. Once the application is created, you will get a popup like below. Copy Client Id and Client Secret, and store them somewhere.
That's all, this is how we successfully registered a client application in Google to access its APIs via OAuth 2.0.