Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Service account impersonation with --scopes doesn't work as documented #1864

Closed as duplicate

Description

@SebastianMohrStade

The README's service account impersonation instructions don't work as documented due to a known limitation in Google's authentication libraries.

Problem:

gcloud auth application-default login \
  --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
  --scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform

The --scopes parameter is ignored when using impersonation with ADC. The generated token only contains cloud-platform scope, missing analytics.readonly.

Test to reproduce:

# After running the README's impersonation command:
TOKEN=$(gcloud auth application-default print-access-token)
curl "https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=$TOKEN"

# Output shows only: "scope": "https://www.googleapis.com/auth/cloud-platform"
# Missing: https://www.googleapis.com/auth/analytics.readonly

This causes 403 errors when the MCP server attempts Data API calls.

Root cause:
Google confirmed this is a limitation - scopes aren't stored in the ADC file format for impersonated service accounts. See: googleapis/google-cloud-python#15196

</claude summary>

This was quite annoying to figure out, from the Issue discussion in the python lib, it is 'working as expected' and too much effort to fix. Therefore to spare future users of the MCP server please mention that in the readme.

Activity

  1. SebastianMohrStade commented on Nov 6, 2025

    @SebastianMohrStade
    Author

    my bad, should have been created in the google analytics mcp repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions