How to obtain Google OAuth2.0 Credentials
- Visit Google API Console.
- Click Create Project, and follow the wizard to create a new project.
- Go to Dashboard, click on ENABLE APIS AND SERVICES and select the Google API you want, and click ENABLE.
- Go to the Credentials → OAuth consent screen, enter a product name to be shown to users, and click Save.
- On the Credentials tab, click Create credentials and select OAuth Client ID.
- Select an application type, enter a name for the application, and specify a redirect URI.
- NOTE: Enter https://developers.google.com/oauthplayground if you want to use OAuth 2.0 playground to receive the Authorization Code, Access Token, and Refresh Token.
vi. Click Create. Your Client ID and Client Secret will appear as a popup.
- Visit OAuth 2.0 playground, in a separate browser window or tab.
- Click the ⚙️ (settings icon) in the top right corner, and you can obtain the Token endpoint.
- Tick Use your OAuth credentials in pop-down of ⚙️ and paste the obtained Client ID and Client Secret there.
- On the left side of the window, under Step 1 - Select & authorize APIs, select the required Google API scopes, and then click Authorize APIs.
- When you receive your Authorization Code, click Exchange Authorization Code for tokens to obtain the Refresh Token and Access token.
Now you have obtained the followings:
- Authorization Code
- Refresh Token
- Access token
- Token endpoint
- Client ID
- Client Secret