tokenx-auth

Exchange tokens with TokenX for secure service-to-service authentication on NAIS.

1|1|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/navikt/watson-sak-frontend --skill tokenx-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tokenx-auth
Source: https://github.com/navikt/watson-sak-frontend/tree/main/.opencode/skills/tokenx-auth
Command: npx skills add https://github.com/navikt/watson-sak-frontend --skill tokenx-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TokenX-based service-to-service authentication eliminates the need to manage long-lived credentials by enabling a token exchange pattern to obtain downstream tokens for inter-service calls in a NAIS environment.

Core Features & Use Cases

  • Token exchange with client assertions and optional caching to improve performance and resilience.
  • Downstream service calls secured with exchanged tokens and inbound TokenX token validation on protected endpoints.
  • Ktor integration patterns and testing guidance, including MockOAuth2Server support, for end-to-end validation.

Quick Start

Configure the NAIS manifest to enable TokenX, generate a private JWK, and deploy a sample service that uses TokenX to request a downstream token before calling another service.

Frequently Asked Questions about tokenx-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement secure service-to-service authentication without managing long-lived credentials?

Service-to-service authentication eliminates long-lived credentials by using a token exchange pattern to obtain downstream tokens for inter-service calls. This approach secures backend services without exposing static secrets.

How does token exchange work for securing downstream service calls?

Token exchange works by generating a client assertion signed with a private JWK and trading it for a downstream token. The exchanged token is then attached to requests when calling other backend services.

How do I configure a NAIS manifest to enable TokenX for my backend service?

To enable TokenX, you must configure your NAIS manifest to provision the necessary settings and generate a private JWK. This setup allows your service to securely request tokens for downstream calls.

Does TokenX integration work with Ktor for protected endpoints?

Yes, TokenX integrates with Ktor to secure protected endpoints using inbound JWT validation. The integration patterns include testing guidance with MockOAuth2Server for end-to-end validation.

What is the best way to test OAuth2 token exchange and JWT validation locally?

The best way to test JWT validation and token exchange locally is by using MockOAuth2Server. It provides end-to-end testing guidance to ensure your Ktor integration patterns function correctly before deployment.

Can I cache exchanged tokens to improve service-to-service authentication performance?

Yes, you can cache exchanged tokens to improve both performance and resilience. Caching prevents redundant token exchange requests during frequent service-to-service calls.