Skip to main content

Get an GCP Credentials instance

Project description

gae-impersonate-credentials

Get an GCP Credentials instance

App runs in GCP, return None for use Application Default Credentials(ADC). When runs in local, impersonate requested service account by ADC. (In local environment, ADC is developer's own google account that signed in with gcloud auth application-default login in normal usage.)

If use this function on Cloud Functions Python 3.9 Runtime, this function cannot detect actual run environment, because not supplied to GOOGLE_CLOUD_PROJECT or GCP_PROJECT environment variables. You need to supply these value in deploy Cloud Functions deployment parameter or set is_run_on_gcp parameter in this function.

Example usage

from gae_credentials import get_credentials
from google.cloud import ndb


credentials = get_credentials(
    service_account='example@appspot.gserviceaccount.com',
    scopes=[
      'https://www.googleapis.com/auth/datastore'
    ]
)

client = ndb.Client(credentials=credentials)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gae-impersonate-credentials-0.1.5.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file gae-impersonate-credentials-0.1.5.tar.gz.

File metadata

  • Download URL: gae-impersonate-credentials-0.1.5.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for gae-impersonate-credentials-0.1.5.tar.gz
Algorithm Hash digest
SHA256 12ec1a019d071f37675070eaed024ab68cb8e81cdaafccef74b5598b52d19edf
MD5 ce065a2924446d397878e77cdbf32bce
BLAKE2b-256 bcd4edb22cc9619811d31c740cc7db27ce633c41e0945da47bef2a0624f55650

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page