nav-auth

nav-auth is a skill for Claude Code, Codex from navikt/copilot. It costs 27 tokens per session (3,115 once invoked), scanned A, original, MIT.

A guide to adding login and access control to Nav applications. It covers Azure AD, TokenX, ID-porten, Maskinporten, and JWTs, which are signed data tokens used to prove identity and permissions.

In plain words
What is it for?
Use it to authenticate Nav employees, citizens, or machines; set up calls between services; validate tokens; configure Azure AD, ID-porten, or Maskinporten; and inspect authentication configuration when debugging.
Why use it?
It helps developers choose the right identity system and diagnose failed logins or service-to-service authentication instead of handling each case from scratch.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to authenticate Nav employees, citizens, or machines; set up calls between services; validate tokens; configure Azure AD, ID-porten, or Maskinporten; and inspect authentication configuration when debugging.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/navikt/copilot/nav-auth
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add navikt/copilot --skill nav-auth
Clone the repo
git clone --depth 1 https://github.com/navikt/copilot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for nav-auth

README.md
[![agentmods](https://agentmods.dev/badge/skills/navikt/copilot/nav-auth/github.svg)](https://agentmods.dev/skills/navikt/copilot/nav-auth)
Your own site
<a href="https://agentmods.dev/skills/navikt/copilot/nav-auth"><img src="https://agentmods.dev/badge/skills/navikt/copilot/nav-auth/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for nav-auth

Your own site · 80×15
<a href="https://agentmods.dev/skills/navikt/copilot/nav-auth"><img src="https://agentmods.dev/badge/skills/navikt/copilot/nav-auth.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,115 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 26
    Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
    Fix: Add human-in-the-loop confirmation for destructive, irreversible, or high-impact operations. Never auto-execute commands that modify files, send data, or alter system state.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00027 $0.03115
Opus 5 $0.00014 $0.01558
Sonnet 5 $0.00005 $0.00623
Haiku 4.5 $0.00003 $0.00312

Measured 7d ago against content hash 9d074d682fbe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

nav-auth scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -s "https://login.microsoftonline.com/nav.no/.well-known/openid-configuration" | jq .
skills/nav-auth/SKILL.md · 445 lines

How it starts

The opening of the file, as written. The whole thing — 445 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Patterns for authentication and authorization in Nav applications. Covers Azure AD, TokenX, ID-porten, Maskinporten, and JWT validation.

When to Use

  • Adding authentication to a Nais application
  • Implementing service-to-service calls with TokenX
  • Validating JWT tokens (Azure AD, ID-porten)
  • Setting up machine-to-machine auth with Maskinporten
  • Debugging auth failures

Commands

# Decode JWT token payload (without verification — note: uses tr for base64url)
echo "<token>" | cut -d'.' -f2 | tr '_-' '/+' | base64 -d 2>/dev/null | jq .

# Fetch Azure AD OpenID config
curl -s "https://login.microsoftonline.com/nav.no/.well-known/openid-configuration" | jq .

# Check auth env var names in pod (works with distroless/Chainguard, values hidden)
kubectl get pod <pod> -n <namespace> -o jsonpath='{range .spec.containers[0].env[*]}{.name}{"\n"}{end}' | grep -E 'AZURE|TOKEN_X|IDPORTEN'
# Or use Nais Console: https://console.nav.cloud.nais.io -> App -> Env vars

# Test if JWKS endpoint is reachable
curl -s "$AZURE_OPENID_CONFIG_JWKS_URI" | jq '.keys | length'

Authentication Types

1. Azure AD (Internal Nav Users)

Use when: Internal Nav employees need to access the application.

Nais Configuration:

azure:
  application:
    enabled: true
    tenant: nav.no

Environment Variables (auto-injected): AZURE_APP_CLIENT_ID, AZURE_APP_CLIENT_SECRET, AZURE_APP_WELL_KNOWN_URL, AZURE_OPENID_CONFIG_ISSUER, AZURE_OPENID_CONFIG_JWKS_URI

Kotlin/Ktor:

install(Authentication) {
    jwt("azureAd") {
        verifier(azureAdConfiguration.jwksUri)
        validate { credential ->
            val audience = credential.payload.audience
            val roles = credential.payload.getClaim("roles")?.asList(String::class.java)

            if (audience.contains(expectedAudience)) {
                JWTPrincipal(credential.payload)
            } else null
        }
    }
}

routing {
    authenticate("azureAd") {
        get("/api/internal") {
            val principal = call.principal<JWTPrincipal>()
            val userId = principal?.payload?.subject
            call.respond(data)
        }
    }
}

Read the full file on GitHub · 445 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · +137 lines 9d074d682fbe
  2. 11d ago First seen · 308 lines · 27 tokens per session scan A 61990d2e9ea8

Subscribe to this mod's changes

nav-auth is a skill published in the GitHub repository navikt/copilot (54 stars, last pushed today), licensed MIT. It adds 27 tokens to every session and 3,115 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.