CoderJony

Register a Client application in Google to access Google APIs via OAuth 2.0

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: Follow the below steps:

  • Select project (i.e. Login with Google Demo)
  • Create credentials
  • OAuth client ID

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 3: Note: Before you create a client ID, you have to configure a consent screen. Click Configure Consent Screen button.

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 4: Fill out the basic information in wizard step 1 - OAuth consent screen.

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 5: Select all basic scopes openid, email & profile.

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 6: For testing, put your email id here. You can add multiple test users here. Register a Client application in Google to access Google APIs via OAuth 2.0

Step 7: Finally, go to the Credentials tab again. Select Application Type > Web application and enter a name for the application.

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 8: Enter the URL of your application where you want Google to redirect post-authentication.

Register a Client application in Google to access Google APIs via OAuth 2.0

Step 9: Hit Create button. Once the application is created, you will get a popup like THE below. Copy Client Id and Client Secret, and store them somewhere.

Register a Client application in Google to access Google APIs via OAuth 2.0

That's all, this is how we successfully registered a client application in Google to access its APIs via OAuth 2.0.

Buy Me A Coffee