Skip to content

tonglil/iap-token-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IAP Token Generator

Generate OIDC tokens to use in HTTP requests for the Authorization: Bearer header to make authenticated requests to Cloud IAP-secured resources.

Implements this flow outlined by the GCP documentation.

Thanks to https://github.com/b4b4r07/iap_curl for implementing the OAuth flow.

Options

$ iap-token-generator -h
Generate a Bearer token for making HTTP requests to IAP-protected apps

Usage:
  iap-token-generator [flags]

Flags:
  -c, --credentials string   The service account JSON credential [GOOGLE_APPLICATION_CREDENTIALS]
  -f, --filename string      Write the token to a file
  -h, --help                 help for iap-token-generator
  -i, --id string            The IAP client ID [IAP_CLIENT_ID]
  -r, --refresh duration     Refresh the token on a specified interval

Usage

  1. Run as a sidecar container, refresh and output the token to a file that is read by the main application.
  2. Run with refresh and consume the token from stdout.
  3. Run as a subcommand with curl --header "Authorization: Bearer $(iap-token-generator)" ...

About

Generate OAuth Bearer tokens for authenticating Service Accounts through GCP IAP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published