Skip to main content

Create your own Google OAuth 2 account

In order to use some Google APIs (like GMail), you'll need your own Google OAuth account to access private and sensible scope

The official Google Guide is available here: https://support.google.com/cloud/answer/6158849?hl=en

1. Create a new project on GCP

Go on Google Cloud Platform Console

From the project list, select or create a new project. You can give the name you want (maybe the automation you're trying to achieve on Meta API?)

Select GCP Project

2. Enable the APIs you need

From the left menu, go on APIs & Services and Library

Enable APIs menu

Search for the API you want

Search API

Select the right API

Select API

Click on Enable to activate it

Select API

You can repeat as much as needed this step to enable more APIs on your Google Account. You can also do it later.

3. Access Credentials

From the left menu, go on APIs & Services and Credentials

Access Credentials

4. Create a new OAuth client ID

Click on Create credentials and select OAuth client ID

Create OAuth client

For the first time, you'll have to configure the consent screen. Click on Configure consent screen to start the configuration

First time consent screen

Otherwise, you can jump to step 6


For the consent screen:

  • Choose internal if you want to use it with your own user account or inside a Google Workspace account.
  • Otherwise, choose external. You can use your app without verification during your tests and your refresh token validity will be limited to 7 days.

Consent type

You have now to fill some required information. Only the following fields are required. Click Save and continue when you finish.

Consent fill

You'll now select the scope needed for your authentication. Click on Add or remove scopes to open the right panel and use the search input to filter them.

Select scopes

To know which scopes you need to add, you can refer to your OAuth configuration window on Meta API. The list of available scopes is display there.

Here is an example with Google Spreadsheet:

Scopes Meta API

One done, click Save and continue and the consent screen setup is finished. You can click Back to dashboard and the end of page and go back to Step 4

6. Configure a new OAuth client ID

Select Web application for Application type

Choose a Name

Under Authorized redirect URIs, add the URL given by the OAuth configuration window on Meta API

Configure OAuth client ID

This is where you can find the URL:

URL Meta API

Once it's done, click on Create to retrieve the Client ID and Client Secret

7. Finish the OAuth configuration on Meta API

Copy and paste your Client ID and Client Secret from this popup to your Meta API configuration window

Popup Client ID

Configure the OAuth on Meta API like this:

Configure OAuth Meta API

Client ID and Client Secret must have the value from the created credential from Google Cloud Platform

On Permissions needed, select the right permissions you need (choose on step 5)

For the Scope Delimited, add a blank space: " "

Finally, you'll need to add two custom parameters:

  • prompt: consent
  • access_type: offline

Now the configuration is completed!

Click Authorize a new profile, and you'll see the Google OAuth popup with our own app inside!

OAuth Popup

Select a profile, validate the authorization and your Google account is now ready to use.

info

You can reuse the same Client ID and Client Secret on other Google APIs.

To access the Client ID and Client Secret later, go on the Credentials menu and select a previously created OAuth Client ID