Generate a token from TokenX for development¶
This how-to guides you through the steps required to generate a token that you can use against an API secured with TokenX in the development environments.
Grant access¶
Grant access to the token generator service:
app.yaml
spec:
tokenx:
enabled: true
accessPolicy:
inbound:
rules:
- application: tokenx-token-generator
namespace: aura
cluster: dev-gcp
Generate token¶
- Visit https://tokenx-token-generator.intern.dev.nav.no/api/obo?aud=<audience> in your browser.
- Replace
<audience>
with the intended audience of the token, in this case the API application. - The audience value must be on the form of
<cluster>:<namespace>:<application>
- For example:
dev-gcp:my-team:my-app
- Replace
- You will be redirected to log in at ID-porten (if not already logged in).
- After logging in, you should be redirected back to the token generator and presented with a JSON response containing an
access_token
. - Use the
access_token
as a Bearer token to consume the API application.