Categorygithub.com/CloudMile/go-iap-oauth2-sample
repositorypackage
0.0.0-20210310100350-c5d57b2e3c9f
Repository: https://github.com/cloudmile/go-iap-oauth2-sample.git
Documentation: pkg.go.dev

# README

GCP IAP Oauth2 with Golang Sample

This is a sample code for access GAE standard through IAP.

Before User

  1. Setup a GAE web server.
  2. Setup a IAP for GAE.
  3. Create a service account only for access GAE through IAP.
  4. Download the service account key json file.
  5. Get IAP client ID.

More detail

Use

$ GAE_WEB_URI="<YOUR_GAE_URL>" \
CLIENT_ID="<YOUR_IAP_CLIENT_ID>" \
SEVICE_ACCOUNT_KEY_PATH="<YOUR_JSON_KEY_PATH>" \
go run ./main.go

for exmaple:

$ GAE_WEB_URI="https://<PROJECT_ID>.appspot.com" \
CLIENT_ID="<RANDOM_STRING>.apps.googleusercontent.com" \
SEVICE_ACCOUNT_KEY_PATH="key.json" \
go run ./main.go