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 — Google Cloud Service Accounts not working with Python Google Cloud Client Libraries · Issue #3383 · googleapis/google-cloud-python

Google Cloud Service Accounts not working with Python Google Cloud Client Libraries #3383

New issue
Copy link
New issue
Copy link
Closed
Closed
Google Cloud Service Accounts not working with Python Google Cloud Client Libraries#3383
Copy link
Labels
authtype: questionRequest for information or clarification. Not an issue.

Description

@ghost
ghost
opened on May 8, 2017

Information

OS: Mac OS X El Capitan 10.11.6

Python: Python 2.7.11

Google Cloud:

  • Name: google-cloud
  • Version: 0.22.0
  • Summary: API Client library for Google Cloud
  • Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
  • Author: Google Cloud Platform
  • Author-email: [email protected]
  • License: Apache 2.0
  • Location: /Users/ochall/.envs/env/lib/python2.7/site-packages
  • Requires: google-cloud-pubsub, google-cloud-runtimeconfig, google-cloud-bigtable, google-cloud-bigquery, google-cloud-core, google-cloud-resource-manager, google-cloud-datastore, google-cloud-logging, google-cloud-translate, google-cloud-storage, google-cloud-happybase, google-cloud-language, google-cloud-dns, google-cloud-vision, google-cloud-error-reporting, google-cloud-monitoring

Google Cloud Datastore

  • Name: google-cloud-datastore
  • Version: 1.0.0
  • Summary: Python Client for Google Cloud Datastore
  • Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
  • Author: Google Cloud Platform
  • Author-email: [email protected]
  • License: Apache 2.0
  • Location: /Users/ochall/.envs/env/lib/python2.7/site-packages
  • Requires: gapic-google-cloud-datastore-v1, google-cloud-core, google-gax

How to reproduce

My goal is to use service accounts running on-premise infrastructure (A Docker container on my laptop) for accessing Cloud Datastore. I created a Google Cloud service account following the instructions on the page https://cloud.google.com/docs/authentication. I downloaded the credentials file and pointed the GOOGLE_APPLICATION_CREDENTIALS environment variable to that file. Then tried to access Datastore using Python Datastore Library: google-cloud-datastore. I get an error saying that project or resource does not exist or insufficient permissions. My understanding is that Google Cloud Client Libraries does not support Service Accounts. Only Google Cloud API Client supports client libraries. This is a big pain to use Google Cloud Client Libraries, which are so awesome and idiomatic to use. Please enable or fix the usage of service accounts with Google Cloud Client Libraries. Thanks!

The instructions for creating service account

Service running on-premises

To run your code outside Google Cloud Platform, such as in your own private datacenter or in another public cloud, you should use Application Default Credentials with explicitly created service accounts:

Use the Google Cloud Platform Console to create a service account, and download its credentials JSON file to your servers. Make sure to keep the file secure.
Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your downloaded credentials JSON file.

Activity

  1. ghost changed the title [-] Google Cloud Service Accounts not working with Python Client Libraries[/-] [+] Google Cloud Service Accounts not working with Python Google Cloud Client Libraries[/+] on May 8, 2017
  2. dhermes commented on May 8, 2017

    @dhermes
    dhermes
    on May 8, 2017
    Contributor
    More actions

    @obulpathi We do support service accounts, in fact it's the "primary" auth type we recommend.

    I get an error saying that project or resource does not exist or insufficient permissions

    It's likely that you project has not yet enabled the Google Cloud Datastore API or that you have a mismatch between your project and your service account.

    Have you read our auth doc yet?

  3. dhermes
    added
    auth
    type: questionRequest for information or clarification. Not an issue.
    on May 8, 2017
  4. ghost closed this as completedon May 8, 2017
  5. dhermes commented on May 8, 2017

    @dhermes
    dhermes
    on May 8, 2017
    Contributor
    More actions

    I thought that by merely clicking on the "Create service account" and creating an account from Cloud Console gives the permissions to get access tokens.

    This should work, it's possible you unclicked something by mistake?

  6. JustinBeckwith
    assigned
    ghost
    on Feb 1, 2021
  7. parthea
    added a commit that references this issue on Oct 21, 2023

    chore: move samples from python-docs-sample (#45)

    d369a34
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

    authtype: questionRequest for information or clarification. Not an issue.

    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.