Following the README: json key is missing the type field.

Created on 31 January 2022, almost 3 years ago
Updated 14 February 2024, 11 months ago

Problem/Motivation

Following the README file steps at: https://git.drupalcode.org/project/google_analytics_reports/-/blob/4.0.x/README.md when you try to upload your downloaded JSON file, you'd get an error:

There was an authentication error. Message: json key is missing the type field.

πŸ› Bug report
Status

Active

Version

4.0

Component

API module

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΏπŸ‡¦South Africa alabandit

    I'm having no luck with the

    1. README,
    2. #3 Service account
    3. or the solution in the interface:
      Add a credential and put json file here https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries#step_2_add_service_account_to_the_google_analytics_4_property

    I am just missing the obvious?

    All I get from all is:

        There was an authentication error. Message: Could not construct ApplicationDefaultCredentials.
        Credential is not valid. Check your configured property also!
  • πŸ‡¨πŸ‡¦Canada megan_m

    The instructions from the link don't work either. What you want is a credentials file in json format with a file name like your-property-name-[string of numbers].json.

    When I set this up in developers.google I followed the instructions in the Readme and it did generate a service account. From API/service details, look for Service Accounts. Then edit that, and use the Keys tab to create a new key. This will let you generate the json file.

    That will let you download a json file. That's what you need to upload in the module settings.

    Then, as marco mentioned in #3, you need to add that email address as a user in GA4. From GA4, go to Admin then look for Account access management.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States kurttrowbridge

    I got confused by this too, and Megan's comment in #5 is what finally cleared it up for me after first reviewing both the module's description and the README in the code. After following her instructions, I went into both the README and the help text on the settings form to make the steps clearer.

    It also wasn't immediately clear to me that I had to enter the Google Analytics property ID before uploading the service account's credential JSON file; I worked through the form top-to-bottom and kept getting errors because I was uploading the JSON file without having put in the property ID. To alleviate the potential for that tripping people up in the future, I swapped the order of the two fields, so you're more likely to have entered the property ID before attempting to upload your credentials.

    Both changes are available in the merge request that's now on this issue. Reviews and other thoughts welcome. Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States ben.hamelin Adirondack Mountains, NY

    Just came across this during setup and same problem. Reviewed the MR it looks good, updated status to get this updated documentation committed. Thanks all!

Production build 0.71.5 2024