You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To authenticate with an OpenFaaS deployment that has [Identity and Access Management (IAM)](https://docs.openfaas.com/openfaas-pro/iam/overview/) enabled, the client needs to exchange an ID token for an OpenFaaS ID token.
37
+
38
+
To get a token that can be exchanged for an OpenFaaS token you need to implement the `TokenSource` interface.
39
+
40
+
This is an example of a token source that gets a service account token mounted into a pod with [ServiceAccount token volume projection](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#serviceaccount-token-volume-projection).
return"", fmt.Errorf("unable to load service account token: %s", err)
55
+
}
56
+
57
+
returnstring(idToken), nil
58
+
}
59
+
```
60
+
61
+
The service account token returned by the `TokenSource` is automatically exchanged for an OpenFaaS token that is then used in the Authorization header for all requests made to the API.
62
+
63
+
If the OpenFaaS token is expired the `TokenSource` is asked for a token and the token exchange will run again.
0 commit comments