Skip to main content

Perform authentication for Google Cloud Identity Aware Proxy from a service account

Project description

Google IAP authentication

This module contains a helper class to make requests to an app running behind a Google Identity-Aware Proxy. The code was obtained from the Google Programmatic authentication document.

Install

pip install iap-auth

Usage

from iap_auth import IapClient

IAM_SCOPE = 'https://www.googleapis.com/auth/iam'
OAUTH_TOKEN_URI = 'https://www.googleapis.com/oauth2/v4/token'

cli = IapClient(OAUTH_TOKEN_URI, IAM_SCOPE)
resp = cli.make_iap_request(url, self.client_id, method=method, **kwargs)

# resp is a requests.Response object.

If running outside Google Cloud Platform you need to specify env var GOOGLE_APPLICATION_CREDENTIALS to point to your authorized service account.

Project details


Download files

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

Files for iap-auth, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size iap_auth-0.1.3-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size iap-auth-0.1.3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page