Skip to content

Python logic to fetch access tokens from within GCE instances via request. No external dependencies except for Python 3.

Notifications You must be signed in to change notification settings

brighton1101/gcp-metadata-access-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GCE Service Account Access Token Extractor

  • Python logic to fetch the application-default service account programatically from within GCE, App Engine, Cloudfunctions, or other GCE-associated services

Usage

  • Suppose you need to make an authenticated request to a GCP endpoint from within a GCE instance
  • Your service account has proper IAM perms to perform action, but you just need to retrieve the access tokens associated with it
from gcp_access_tokens import access_token_string_from_metadata

# Fetch access token
token = access_token_string_from_metadata()

About

Python logic to fetch access tokens from within GCE instances via request. No external dependencies except for Python 3.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages