Download
Client ID and Client Secret in Google Developers Console

How To Get Google Client ID and Client Secret From Google Developers Console

Google Client ID and Client Secret are required for authentication and authorization purposes when integrating applications with Google services, such as Google APIs or OAuth-based authentication. The Client ID and Client Secret are obtained from the Google Developers Console when you create a new project and enable the corresponding APIs.

In this article, we’ll guide you through setting up Google Client ID and Client Secret for authentication and authorization when integrating applications with Google services.

How To Setup Google Client ID and Client Secret on the Google Developers Console

One of the most important tasks when integrating Google APIs into your application is to obtain the Google Client ID and Client Secret from the Google Developers Console. 

After receiving these credentials, you can authenticate with various Google services, including Drive, Calendar, YouTube, and Analytics. Fortunately, getting a Client ID and Secret from the Developers Console is easy.

Let’s see step by step how to do it.

Step 1: Go To Google Developers Console

First, go to the Google Developers Console and log in with your Google account.

Step 2: Create A New Project

Once logged in, click the Create Project button to create a new project.

Create Project

On the next page, you will be asked to enter your Project Name. This name will help you recognize your project in the console, so make sure it is meaningful. 

After that, click on the Create button.

Project Name

Wait a couple of seconds while your project gets created. You will see a notification when your project is ready.

Click on the Select Project link to enter the dashboard for the project you just created.

Select Project

Step 3: Enable Required Google Analytics API

  • Google Analytics API
  • Google Analytics Reporting API
  • Google Analytics Admin API
  • Google Analytics Data API
  • Google Search Console API

Now, you need to enable five APIs for this project to work. First, hover over APIs and Services in the navigation menu on the left and click Library.

Navigate Library

Type Google Analytics API in the search box and click on the result.

Click Google Analytics API

On the next page, click on Enable API button.

Enable Google Analytics API

Repeat the same steps for “Google Analytics Reporting API.”

Click on Library on the left menu.

Click on Library

Type “Google Analytics Reporting API” in the search box and click on the result. 

Google Analytics Reporting API

On the next page, click on Enable API button. 

Google Analytics Reporting API Enable

In addition to the two APIs mentioned above, you should also consider selecting three more APIs to enable in your Google Cloud Console:

  • Google Analytics Admin API: This API is focused on administrative tasks related to Google Analytics. It allows users to manage account permissions, create and manage custom dimensions and metrics, and perform other administrative tasks.
  • Google Analytics Data API: This API provides a more flexible and powerful way to access and retrieve data from Google Analytics than the Google Analytics API. It supports more advanced querying and filtering, allowing users to retrieve data from multiple views or properties simultaneously.
  • Google Search Console API: This API allows users to programmatically access data from Google Search Console, which provides insights into how their website appears in Google search results. It can be used to retrieve information such as search queries, impressions, click-through rates, and more.

Before you can generate the Client ID and Secret, you need to configure the OAuth Consent Screen in the project.

Click the “OAuth consent screen.” On the next page, set the “User Type” to “External” and click Create.

Oath Consent Screen

Next, enter all the required details, such as App Name and Support Email, and click Save And Continue.

App information

Note: The information under “App domain” is not required. If you leave it empty, your App will be “unverified,” You will see an “Unverified App” alert when you try to log in from this App. If you add the information under (The application home page, Application privacy policy link, and Application terms of server link), Google (in some time) will verify the App.

After clicking “Save and Continue,” you will be taken to the Scopes page; you don’t need to change anything here. Just click “Save and Continue.”

Scopes

Next, you will see the “Test User” page; you don’t need to change anything here. Just click “Save and Continue.”

Test Users

Lastly, click “Back to Dashboard” to return to the “OAuth consent screen” dashboard.

Back to Dashboard

Step 5: Publish the App

The next step is to publish your App. To do this, click on the “Publish APP” button.

Publish App

A popup will ask for confirmation; click “Confirm.” Your App is now published and ready to use.

Step 6: Generate Credentials

The final step is to generate the Client ID and Secret. To do this, navigate Credentials in the left navigation menu.

On this page, click “Create Credentials” and select “OAuth Client ID”. You will be redirected to the “Create OAuth click ID” page.

Create Credenticials

On the next page, select “Web Application” and enter your application name in the textbox.

Select Web Application

Next, on the same page, you will find the “Authorised redirect URIs” section. This is where you will paste the redirect URL, which you got from Analytify >> Setting >> Advanced (tab).

Copy Redirect URL

Next, paste the URL in this Authorised Redirect URLs field and click “Create.”

Click on Create Button

You will now see a popup window containing your Client ID and Secret. Make sure you copy this information somewhere safe and click “OK.”

Client ID and Secret

And that’s it! Your Google Developers Console setup is complete. You can now use the Client ID and Secret in Analytify’s settings to connect your Google Analytics account with your WordPress website.

Let’s see how you can do that in the next step.

Step 7: Configure Analytify Settings

Now that you have your Client ID and Secret, it’s time to configure the Analytify settings. To do this, go to Analytify >> Settings. Next, Click on the Advanced Tab.

Next, in the “Setup Custom API Keys” section, paste your Client ID and Secret that you copied from Google Developers Console. The “Redirect URL” will be the URL you see written below. Just copy and paste from there and “Save Settings.”

Id Secret URL

Next, you need to authenticate your Google Analytics Account with Analytify

To do this, go to Analytify Settings >> Authentication and click “Log in with your Google Analytics Account.”

Authentication

After clicking “Log in with your Google Analytics Account,” you will be redirected to the Google Accounts Authentication page; you have to select the Google Account associated with your Google Analytics account.

Choose an Account

App Verification Alert

You may get the “This app isn’t verified” alert during the authentication of your Google account. You can continue without app verification by clicking on the “Advanced” option and the “Go to *YOURDOMAINNAME* (unsafe)” link.

Although you can continue using an “Unverified App,” if you want to verify your App, don’t worry. We have covered this in the next heading.

In the next step, you will be asked to Allow the permissions. You have to click on the Continue button.

Click Allow Button

And that’s it! Your Google Analytics account is now successfully connected with Analytify. You will be redirected back to Analytify >> Profiles. You must select “Profiles for posts” and “Profile for dashboard.”

Profile Post and Dashboard
  • “Profiles for posts” is the profile used for tracking users.
  • “Profile for dashboard” is the profile used for showing stats on Analytify’s Dashboard.

For most people, both these options will be the same. After selection, click “Save Changes.”

Congratulations! you have successfully implemented the Google Analytics APIs key for Analytics Tracking in Analytify. You can get the Client ID and Client Secret key from Google Developers Search Console.

How To Verify The App

Once you have created the Client ID and Secret, verifying your App is important. To do this, follow the steps below:

Step 1: Open the Google Cloud Platform page. Open the dashboard of the project you just created (the project whose keys you are using in Analytify).

Step 2: Click on the “Hamburger” menu to open the navigation menu. Hover over “APIs & Services” and click “OAuth consent screen”.

Navigate OAuth Consent Screen

Step 3: You will be taken to the Dashboard of the App you created. Click on the “Edit App” link.

Click on Edit App

Step 4: Fill in all the fields under “App domain”.

  • “Application home page” is the link to your website’s home page.
  • “Application privacy policy link” is the link to the privacy policy page of your website.
  • “Application terms of service link” is the link to your website’s terms of service page.
App Domain

After filling in the information with the appropriate links, click “Save and Continue.”

Step 5: You will be taken to the “Scopes” page, just click Save and Continue.” Again click Save and Continue on the “Optional info” page. Lastly “Back to the Dashboard” button on the “Summary” page.

Note: After you confirm or submit the app, the Google Trust and Quality team will contact you through email to verify your property ownership through the Google search console.

Google’s trust and quality team will verify the data on your site and email you once they have verified your app.

Conclusion

That’s all! We hope after reading this article, you can easily connect your Analytify site with Google Analytics. If you have any comments feel free to ask us via the comment section below.

You can also check out our guide on How to Migrate to Google Analytics 4 (Step by Step).

Frequently Asked Questions

Why do we need a Google client id and secret key?

For the integration of Web Apps or WordPress plugins, we need a Google client id and secret key

How to get Google Client ID and Client Secret?

Through Google Developer Console you can get Google Client ID and Client Secret.

33 thoughts on “How To Get Google Client ID and Client Secret From Google Developers Console

  1. Thanks a lot, Adnan. It was really helpful. I’ve tried other steps and almost gave up till I met this. I followed the procedure step by step and it got me the result I needed.

  2. Hello ! i am trying to authenticate using this script:

    from pydrive.auth import GoogleAuth
    from pydrive.drive import GoogleDrive

    gauth = GoogleAuth()
    gauth.LoadCredentialsFile(‘client_secrets.json’)

    if gauth.credentials is None:
    gauth.LocalWebserverAuth()
    elif gauth.access_token_expired:
    gauth.Refresh()
    else:
    gauth.Authorize()
    gauth.SaveCredentialsFile(“mycreds.txt”)

    drive = GoogleDrive(gauth)

    but i got this error: KeyError: ‘_module’
    how can i fix it ?? thanks !

  3. I’m getting a similar issue to Mohammad. When I try to authenticate with my own API, it connects to Google, but once I click allow it redirects me back to a 404 page on my site instead of the analytify authentication page.

  4. Hi,
    After I configure my own analytics API key in the plugin when I try to login to my google analytics account I get 403 forbidden error.
    What is the problem?

  5. Hi,
    After I configure my own API key, when I try to login with google analytics account I get 403 Forbidden error.
    What is the problem?

  6. Help me please. I used gdata.youtube.service to upload video on youtube channel – i have YOUTUBE_DEVELOPER_KEY
    gdata sends me error now. As a solve of this problem i wanted to go for API3 but it tells me to use
    CLIENT_SECRETS_FILE = “client_secrets.json”
    What is it? A once more new KEY? Or I cen gen it from
    YOUTUBE_DEVELOPER_KEY ?

    1. In recent update to WP Analytify, You don’t need access code. Simply login with your Google account and you will be connect.

      Update your WP Analytify please.

      1. Ok, thanks. How do I update it Adnan!

        Just to let you know, that when I t to get short url from inside my blog, it went error, and then I couldn’t access my pages, so had to deactivate the plugin! So hope the updated version works.

        🙂

        1. This what I get. Please advise. Thanks!

          Fatal error: Uncaught exception ‘Shortify_WP_Google_Service_Exception’ with message ‘Error calling POST https://www.googleapis.com/urlshortener/v1/url: (403) Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.’ in /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Http/REST.php:79 Stack trace: #0 /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Http/REST.php(44): Shortify_WP_Google_Http_REST::decodeHttpResponse(Object(Shortify_WP_Google_Http_Request)) #1 /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Client.php(503): Shortify_WP_Google_Http_REST::execute(Object(Shortify_WP_Google_Client), Object(Shortify_WP_Google_Http_Request)) #2 /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Service/Resource.php(195): Shortify_WP_Google_Client->execute(Object(Shortify_WP_Google_Http_Request)) #3 /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Service/Urlshortener.php(136): Shortify_WP_Google_Service_Resou in /home3/becomey1/public_html/wp-content/plugins/wp-shortify/src/Google/Http/REST.php on line 79

  7. Hi,,
    I created oauth for installed application i.e., android correctly, but when i downloaded json file in that client secret key is missing.How do i find it, is google changed their policy? Pls help me to find client secret key.

  8. You should update this tutorial. Google has changed its layout and your instructions do not reflect the actual page.

    I am getting a 401 error when requesting “Get your access code”.

  9. Hi,

    I just installed the plugin and it looks really great. But I miss the click route people have. Where can I see on a page where people came from and what page they went to after this particular page or post? I can’t find it in the overview.

    Thanks for your reply in advance.

    1. Hey, you are Premium Customer right ??

      You don’t need to enter Keys. Just authenticate and paste the Access code and it should work.

      Check this video for Premium customers.

Leave a Reply

Your email address will not be published. Required fields are marked *