In this article I will explain how to get Google API Key (Client ID) and API Secret (Client Secret) from Google Developer Console.
In order to access Google APIs using OAUTH, we need to create a Project in Google Developer Console and generate the Google API Key (Client ID) and API Secret (Client Secret). The generated API Key and API Secret will then be used for making OAUTH calls to the Google APIs.
1. Visit Google Developer Console and create a new project.
The very first step is to visit the Google Developer Console website using the following URL and then click the Create Project button in Projects Tab.
And then you need to provide some name to your Project.
2. Choose the APIs
Now we need to choose the APIs we will be using, for that you need to select the APIs from the APIs and AUTH menu as shown below and then click OFF button to enable an API.
Note: Clicking OFF Button enables the API while clicking ON button disables the API.
3. Create new Client ID
The next step is to click select Credentials from the APIs and AUTH menu and then click “Create new Client ID” button.
Clicking on the button opens the following form where you need to choose the Application Type, in our case it will be Web Application.
Then we need to set the Authorized JavaScript Origins where I have set the URL of localhost as currently I will be using the API in Visual Studio Local environment.
Finally we need to specify the Authorized Redirect URI of the application where the user will be redirected after successful authorization.
Once the Client ID is successfully generated it, you will be provided with Client ID key and Client Secret which can be used for accessing the Google APIs using OAUTH.
4. Consent Screen
The final screen is Consent screen where you need to update the primary email address, the name of the Application or Product.
And optionally you can add logo image, home page URL, etc.