Skip to content

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

  1. 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
  2. You will be redirected to log in at ID-porten (if not already logged in).
  3. After logging in, you should be redirected back to the token generator and presented with a JSON response containing an access_token.
  4. Use the access_token as a Bearer token to consume the API application.