A Google Client ID and Client Secret are credentials used to identify your application to Google’s authentication servers (OAuth 2.0). They are essential for any application that needs to access Google APIs, such as Google Drive, Google Calendar, or Gmail. Think of them as a username and password for your application.
1.Navigate to https://console.developers.google.com/apis/
2.Log in with your Google credentials if you are not logged in.
3.If you don’t have a project yet, you’ll need to create one. You can do this by clicking on the “Select a project” button (if you already have a project, then in the top bar click on the name of your project instead). This will bring up a modal, then click “NEW PROJECT”.
4.Name your project and then click on the “Create” button again!
5.Once you have a project, you may see a window where you can click “SELECT PROJECT”. If this is not the case, click on “Select a project” button again in the top bar, and select the newly made project. (If earlier you have already had a Project, then make sure you select the created project in the top bar!)
6.Next, open the navigation menu (click on the burger icon, or press “.” on your keyboard) and go to “APIs & Services” -> “OAuth consent screen”.
7.Click on the blue “Get started” button.
8.Enter a name for your App to the “App name” field, which will appear as the name of the app asking for consent.
9.For the “User support email” field, select an email address that users can use to contact you with questions about their consent.
10.Click on “Next”, and for the “Audience” choose a “User Type” according to your needs and press “Next” again. If you want to enable the social login with Google for any users with a Google account, then pick the “External” option!
Note: We don’t use sensitive or restricted scopes either. But if you will use this App for other purposes too, then you may need to go through an Independent security review!
11.For the “Contact Information” enter an email address (you can set more than one) Google can use to notify you about changes to the project, and click “Next” once more.
12.Agree to the “Google API Services: User Data Policy”, and click “Continue”.
13.You can review the information entered, and if all looks correct, click on the blue “Create” button.
14.Next, select the “Branding” option from the left menu.
15.You can update the “App name” and “User support email” here if needed.
16.Select an “App logo”.
Note: After you upload a logo, you will need to submit your app for verification unless the app is configured for internal use only or has a publishing status of “Testing”!
17.Next, provide the appropriate links to the “Application home page”, “Application privacy policy link” and “Application terms of service link” fields.
18.Under the “Authorized domains” section press the “Add Domain” button and enter your domain name without subdomains, probably: example.com
19.Once you are done, click on the “Save” button.
20.Next, select the “Clients” option from the left menu, then click “Create client”.
21.Choose “Web application” as the “Application type”, and enter a name.
22.Under the “Authorised redirect URIs” section click “Add URI” and add the following URL:
https://example.com/wp-login.php?loginSocial=google
23.Click on the “Create” button.
24.A modal should pop up with your credentials. If that doesn’t happen, go to the “Clients” in the left hand menu and select your app by clicking on its name and you’ll be able to copy-paste the “Client ID” and “Client Secret” from there.
25.Currently, your App is in “Testing” mode, so only limited number of people can use it. To allow this App for any user with a Google Account, click on the “Audience” option on the left side, then click the “Publish app” button under the “Publishing status” section, and press the “Confirm” button.