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?)
2. Enable the APIs you need
From the left menu, go on APIs & Services and Library
Search for the API you want
Select the right API
Click on Enable to activate it
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
4. Create a new OAuth client ID
Click on Create credentials and select OAuth client ID
5. Configure the consent screen (first time only)
For the first time, you'll have to configure the consent screen. Click on Configure consent screen to start the configuration
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.
You have now to fill some required information. Only the following fields are required. Click Save and continue when you finish.
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.
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:
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
This is where you can find the URL:
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
Configure the OAuth on Meta API like this:
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!
Select a profile, validate the authorization and your Google account is now ready to use.
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