This is a similar request to Google console UI update?

As a user, I want to be able to set up the module, so I can get google analytics data.

When setting up Google Analytics Reports at admin/config/system/google-analytics-reports-api
I tried to follow the documentation, but didn't see the UI elements that it mentions. It looks like Google Console changed its interface. Doing my best to follow the documentation with the new interface, here's what I did:

  1. Go to https://console.developers.google.com/apis/library and search for Analytics API. Click on it
  2. Hit Enable at the top
  3. Go to https://console.developers.google.com/apis/credentials
  4. Click Create credentails, click OAuth client ID
  5. Select Web application
  6. Enter the URL listed in the config page (admin/config/system/google-analytics-reports-api) in the Authorized redirect URIs field

I was able to get a client id and client secret, but then when I hit "Start setup and authorize account" I get:

400. That’s an error.
Error: invalid_request
Missing required parameter: client_id
Request details:
response_type=code
redirect_uri=http://www.israelvets.com/

Please update the documentation/instructions or provide a fix. Thanks!

Comments

ben833 created an issue. See original summary.

ben833’s picture

Version: 7.x-1.x-dev » 7.x-3.1
Issue summary: View changes
ben833’s picture

Issue summary: View changes
gisle’s picture

I don't think this is a bug (at least, I do not experience this when I submit the form).

You need to check the parameters that appear under "Request details". Here are mine (URLs and credentials redacted):

response_type=code
redirect_uri=https://XXX/admin/config/system/google-analytics-reports-api
client_id=XXX
scope=https://www.googleapis.com/auth/analytics.readonly https://www.google.com/analytics/feeds/
access_type=offline
approval_prompt=force

The error message indicate that you haven't filled in the box for client_id. If what you reproduce from the request details in the issue summary is all of it, it also looks like you're sending much less data than what is expected.

joknjokn’s picture

I have the same problem with latest version.

jeremyH1024’s picture

I am getting this error with the latest version

Error: invalid_client

The OAuth client was not found.
Request Details

response_type=code
redirect_uri=http://mydomain.com/admin/config/services/google-analytics-reports-api
client_id=XXXXXXXXXXX-XXXXXXXXXXXXXXXXXX.apps.googleusercontent.com+
scope=https://www.googleapis.com/auth/analytics.readonly https://www.google.com/analytics/feeds/
access_type=offline
approval_prompt=force

I tried verifying the domain using the Webmaster Console but, no luck.

*** UPDATE ***
Be sure to check your client ID for white space.

It works for me now.

crutch’s picture

I'm getting no UI at admin/config/system/google-analytics-reports-api after updating Google Analytics module and Google Analytics Reports module yesterday.

Drupal Status

"Google Analytics Reports API authorization. You must authorize Drupal to use your Google Analytics account before you can view reports."

DBLOG

Code: 400, Error: Bad Request, Message:

Array
(
    [error] => invalid_grant
)

I went to google API & Services - selected Analytics API - Enabled it - created service account key - OAuth consent screen - Domain verification - still no go.

deepak goyal’s picture

Check into your database with table-name "variable" and search with "name" "google_analytics_reports_api_refresh_token" .
If it has value then remove it. You can also delete it using drush command i.e "drush vdel google_analytics_reports_api_refresh_token" .
After doing this it will be working fine.
Thankyou

deepak goyal’s picture

Status: Active » Needs review
gisle’s picture

Status: Needs review » Active

No patch has been posted.
See https://www.drupal.org/node/156119 for how to use the "status" field.

I understand that you want your suggested procedure posted 2 years ago in #8 to be reviewed by someone , but that is not what the "Needs review" status field is for.

If this is the cause, how did this database variable get the wrong value in the first place? Probably due to a bug in the module. If so, we need a patch to fix this bug.