Obtain OAuth 2.0 credentials from Google


You can obtain the OAuth 2.0 credentials for your app from the Google API Console (https://console.cloud.google.com/). This implies creating a new project for your app if you haven’t done so yet, configuring an OAuth consent screen, and then creating credentials of type Web Application. Once this process is complete, you can download your authorization details as JSON.

To obtain OAuth 2.0 credentials from the Google API Console:

  1. In the Google API Console, click Select Project from the drop-down list at the top of the page, and then click New Project.

  2. Enter a project name. If your Google account is part of an organization, select the organization to which this project belongs.

    New Google Project

  3. Click Create.

  4. Select your newly created project from the list at the top of the page.

  5. In the navigation menu, click APIs & Services > OAuth Consent Screen.

  6. Click External.

  7. Fill in the application details as required. At the minimum, you will need to provide an app name, a support email, and a developer email.

    Enter App Details

  8. Click Save & Continue.

  9. Click Add or remove scopes, and then select the scopes .../auth/userinfo.email and .../auth/userinfo.profile.

    Select Scopes

  10. Click Update. Your application’s scope should now be visible under Your non-sensitive scopes.

    Selected Scopes

  11. Click Save & Continue.

  12. Optionally, add some test users for your application, and then click Save & Continue.

  13. From the navigation menu, select APIs & Services > Enabled APIs & services.

  14. Click Enable APIs & Services.

  15. Search for the Gmail API and click Enable.

    Enable Gmail API

  16. From the navigation menu, select APIs & Services > Credentials.

  17. Click Create Credentials, and select OAuth Client ID as credential type.

    Create Credentials

  18. Select Web Application as application type, and then enter a name for your client app, for example:

    Application Type

  19. Under “Authorized Redirect URIs”, click Add URI, and enter the URL to which users of your app should be redirected after they allow your app access to their Google account. As further described below, you will need to handle requests at this URL in order to complete the authorization process.

    Application Type

  20. Click Create. Your OAuth 2.0 client has now been created, and you can download it as JSON from the Credentials page.

    Application Type