If you don’t have a project yet, you’ll need to create one. Click on the project dropdown at the top left and then click “New Project.” Follow the prompts to set up the project.
Enable APIs & Services
In the left sidebar, click on “APIs & Services” > “Library.”
Search for your desired API however for this example we will be using the “Gmail API”.
Search for the GMAIL API in the Library and click on the API name in the search results.
Click the “Enable” button for that API.
Configure Consent OAuth Screen
Navigate to the OAuth Consent screen and select User, type “External,” and Click Create
Fill in the required details on the consent screen like app name (Post Mail), user support and developer email, then click save and continue.
Scopes can be left empty will be added automatically, click save and continue.
Create Credentials
After configuring your consent screen, click on “APIs & Services” > “Credentials” in the left sidebar.
Click the “Create Credentials” button.
Choose the “OAuth client ID” option
Configure OAuth Client ID
In your the OAuth client ID, choose “Web application”.
In the “Authorized redirect URIs” section, add the URLs to which Google can send users after they’ve granted/denied permission.
Add the Authorized JavaScript origins and Authorized redirect URI then click Create.