Skip to content

This is a CLI tool that generates a JWT for Service Account authorization on GCP.

License

Notifications You must be signed in to change notification settings

tomchinery/gcp-service-account-jwt-generator

Repository files navigation

GCP Service Account JWT Generator

Unlicense License

This is a CLI tool that generates a JWT for Service Account authorization on GCP.

GCP Service Account JWT Generator is an experimental project used for a very specific use case -- it is generally insecure to output Authorization Bearer tokens on the command-line so please use at your own risk!

Table of contents

Installation

The CLI is an NPM package:

$ npm install -g @tomchinery/gcp-service-account-jwt-generator

Usage

Upon running the CLI it will output an Authorization Bearer token to STDOUT that is signed with your GCP Service Account.

$ gcp-service-account-jwt-generator --service-account <path_to_your_service_account> --target-audience <your_oauth_client_id>

There is some required arguments of the tool:

--service-account

The path to the service account credentials file you want to use to sign your JWT.

--target-audience

The OAuth Client ID for the resource you want to access.

Usecases

The specific usecase this tool was created was for authenticating against service API's that sit behind IAP (Identity Aware Proxy) on GCP. Specifically I'm using the outputted JWT to request an OIDC token for an IAP-secured client ID. It's the OIDC token that I use to actually authenticate against my services behind IAP.

References

Contributing

I imagine this tool could be useful for a number of other usecases. Please if you do contribute feel free to add to the Usecases section in the README.md.

All PR's or feedback is welcome - I normally have a lagg time of about 72 hours on reviews or issues so don't panic if you don't get a response straight away.

License

Unlicense

About

This is a CLI tool that generates a JWT for Service Account authorization on GCP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published