diff --git a/authentication/methods.mdx b/authentication/methods.mdx index 27fe687..5dbea53 100644 --- a/authentication/methods.mdx +++ b/authentication/methods.mdx @@ -187,6 +187,7 @@ The SDKs that currently support this include: - Go + ```go sdk.go package main @@ -196,31 +197,30 @@ import ( ) func main() { -// The following constructs an instance of the SDK which communicates with -// instances of Flipt deployed in the same cluster. -// In this example, we assume Flipt is reachable via a k8s service named -// `flipt` deployed into the namespace `flipt`. -// -// The kubernetes provider automatically authenticates the client with this -// Flipt service. It also ensures that the credentials are kept up to date -// and automatically refreshed before they expire. -transport := http.NewTransport("http://flipt.flipt.svc.cluster.local:8080") -sdk := sdk.New(transport, sdk.WithAuthenticationProvider( -sdk.NewKubernetesAuthenticationProvider(transport), -)) + // The following constructs an instance of the SDK which communicates with + // instances of Flipt deployed in the same cluster. + // In this example, we assume Flipt is reachable via a k8s service named + // `flipt` deployed into the namespace `flipt`. + // + // The kubernetes provider automatically authenticates the client with this + // Flipt service. It also ensures that the credentials are kept up to date + // and automatically refreshed before they expire. + transport := http.NewTransport("http://flipt.flipt.svc.cluster.local:8080") + sdk := sdk.New(transport, sdk.WithAuthenticationProvider( + sdk.NewKubernetesAuthenticationProvider(transport), + )) } - -```` +``` - ### Via the API Acquiring a client token via this method can be performed manually from inside a pod. The following uses `curl` to illustrate how a local, valid service account token can be used in this way. + ```bash client-token.sh # assumes both curl and jq are installed curl -s -X POST http://flipt:8080/auth/v1/method/kubernetes/serviceaccount \ @@ -243,7 +243,7 @@ curl -s -X POST http://flipt:8080/auth/v1/method/kubernetes/serviceaccount \ } } } -```` +```