package
0.0.0-20200616141810-c97285277269
Repository: https://github.com/bakins/iap-token-source.git
Documentation: pkg.go.dev
# README
HTTP client example
Example HTTP request using IAP authentication.
Description
This example shows manually using IAP tokens to authenticate an HTTP request.
One could also use an oauth2 client:
// error handling ommitted
package main
import (
"golang.org/x/oauth2"
iap "github.com/bakins/iap-token-source"
)
func main() {
t, err := iap.New(MY-CLIENT-ID)
c := oauth2.NewClient(context.Background(), t)
// now use c as normal
}
The client-id is the oauth client_id in the credentials associated with your IAP configuration. See https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_a_service_account