GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Datastore v1beta3 client and 403 forbidden · Issue #1778 · googleapis/google-cloud-python

Datastore v1beta3 client and 403 forbidden #1778

New issue
Copy link
New issue
Copy link
Closed
Closed
Datastore v1beta3 client and 403 forbidden#1778
Copy link
Labels
api: datastoreIssues related to the Datastore API.

Description

@ghost
ghost
opened on May 6, 2016

Is anyone seeing this issue in production, or is it just me:

Forbidden: 403 Request had insufficient authentication scopes.

I am using the gcloud-python (version 0.13.0) library (datastore v1beta3). The client is a container in a pod within GKE. I do not set any environ params, and simply initiate the client with:
datastore_client = datastore.Client() #uses project default creds

The trace when running a query is:

Forbidden: 403 Request had insufficient authentication scopes.
at _request():98 (connection.py:98 in /usr/local/lib/python2.7/dist-packages/gcloud/datastore)
at _rpc():121 (connection.py:121 in /usr/local/lib/python2.7/dist-packages/gcloud/datastore)
at run_query():275 (connection.py:275 in /usr/local/lib/python2.7/dist-packages/gcloud/datastore)
at next_page():424 (query.py:424 in /usr/local/lib/python2.7/dist-packages/gcloud/datastore)

From my understanding, the oauth2client which the datastore lib uses, should be getting default project creds from the GCE production environment. The type of error (insufficient scopes) leads me to think the issue is not that the lib cannot find or use gce creds, but that the scopes being requested is not what datastore expects.

Anyone seeing this issue too? I'm wondering if it's a general issue related to scopes or something in my project setup and affecting just me.

Activity

  1. tseaver
    added
    api: datastoreIssues related to the Datastore API.
    on May 6, 2016
  2. tseaver commented on May 6, 2016

    @tseaver
    tseaver
    on May 6, 2016
    Contributor
    More actions

    works for me with a service account

    I'm glad you were able to get your app working.

    something about the default setup in the project that is causing the issue for me, anyway it is not the library then.

    I will close this issue, then. Please comment here if you think there is something that should change in gcloud-python to address the problem.

  3. tseaver
    closed this as completedon May 6, 2016
  4. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    @hir3npatel https://www.googleapis.com/auth/userinfo.email was dropped because it was required in v1beta2 but is no longer required in v1beta3.

  5. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    I'm not familiar with GKE. The "just work" in GCE is enabled by the metadata service. Do containers have access to the metadata service for the underlying instance they run on? /cc @jonparrott

  6. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    kubernetes/kubernetes#8512 may give some insight on this

  7. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    Peeking at the oauth2client implementation, the token is minted via a request to http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token with the header Metadata-Flavor=Google.

  8. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    Yes, but if the token is stale, the service will return a 401. Your 403 indicates that you don't have access.

    Check out the tokeninfo to see if your instance (and hence your token) is authorized with the scopes you need.

  9. dhermes commented on May 6, 2016

    @dhermes
    dhermes
    on May 6, 2016
    Contributor
    More actions

    Good deal!

  10. theacodes commented on May 6, 2016

    @theacodes
    theacodes
    on May 6, 2016
    Contributor
    More actions

    Sorry to be late to the thread, but I'm glad you figured it out @hir3npatel. It can be really easy to miss the scopes setting when creating a cluster.

  11. jgeewax commented on May 9, 2016

    @jgeewax
    jgeewax
    on May 9, 2016
    Contributor
    More actions

    Can we add this to the FAQ or Auth page of the docs? (Might belong in gcloud-common...)

  12. dhermes commented on May 9, 2016

    @dhermes
    dhermes
    on May 9, 2016
    Contributor
    More actions

    @jgeewax it already is in our docs: http://googlecloudplatform.github.io/gcloud-python/0.13.0/gcloud-auth.html#using-google-compute-engine

  13. parthea
    added a commit that references this issue on Nov 26, 2025

    feat: Add trust boundary support for service accounts and impersonati…

    3ebfb7e
  14. parthea
    added a commit that references this issue on Mar 6, 2026

    docs: update query_external_sheets_permanent_table.py to use query_an…

    708cc5c
  15. chalmerlowe
    added 2 commits that reference this issue on Mar 26, 2026

    fix: raise ValueError if api_endpoint is unset when using AnonymousCr…

    e7b6dc1

    chore: librarian release pull request: 20260323T070628Z (#1782)

    0b551dc
  16. parthea
    added a commit that references this issue on Apr 1, 2026

    perf: Optimize repr for unordered gbq table (#1778)

    a2d40ae
  17. parthea
    added a commit that references this issue on Sep 8, 2026

    docs: migrate code from googleapis/python-bigquery (#18303)

    23f9a74
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

    api: datastoreIssues related to the Datastore API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.