Skip to main content

google token generator

Project description

how to use

from gcpTokenGenerator import tokenGenerator

conf = {
    "STG_Conf": {
        "account": '{your service account}',  # need to get from dev ops
        "host": '{your project id}',
        "target_audience": '{your client id}',
        "iap": True,
    },
    "PRD_Conf": {
        "account": '{your service account}',  # need to get from dev ops
        "host": '{your project id}',
        "target_audience": '{your client id}',
        "iap": True,
    }
}
instance = tokenGenerator(conf)
token = instance.generateToken('STG_Conf')
print('token', token)
  • when reusing same instance, generated token will renew the token only if it's expired after one hour
    meaning it remember the last token generated to one of the configs was used on init

example:

    from gcpTokenGenerator import tokenGenerator

conf = {
    "STG_Conf": {
        "account": '{your service account}',  # need to get from dev ops
        "host": '{your project id}',
        "target_audience": '{your client id}',
        "iap": True,
    },
    "PRD_Conf": {
        "account": '{your service account}',  # need to get from dev ops
        "host": '{your project id}',
        "target_audience": '{your client id}',
        "iap": True,
    }
}
instance = tokenGenerator(conf)
stg_token = instance.generateToken('STG_Conf')
prd_token = instance.generateToken('PRD_Conf')
print('stg_token', stg_token)
print('prd_token', prd_token)

# this will generate new token only if it's expired
stg_token = instance.generateToken('STG_Conf')
prd_token = instance.generateToken('PRD_Conf')

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

gcpTokenGenerator-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

gcpTokenGenerator-0.0.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

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