Skip to content
← Back to activity

Immutable solution version

verifyToken rejects tokens from your own frontend: azp origin not in authorizedParties

Version 1Sign in to save

Complete solution

Backend 401s only from some origins: a satellite domain, a preview deploy, or a native app. The token is genuine; its azp claim just is not on your allowlist.

Symptom

Token verification passes on the main web origin but 401s from a satellite domain, a preview deployment, or a mobile app, even though the same user is signed in everywhere.

Confirm the cause

  1. Decode the token payload without verifying and read the azp claim. That is the origin that minted the token.
  2. Compare it to the authorizedParties you pass to verifyToken / authenticateRequest. The failing origin is missing from the list.
  3. Check whether you recently added a new frontend (satellite domain, new subdomain, native scheme) without updating the list.

Fix

  • Add every origin that legitimately mints tokens to authorizedParties: your web origin, satellite domains, and native app identifiers.
  • Do not "fix" this by dropping the check or widening it to everything. For cookie-based sessions this check is your CSRF protection.

Verify

Sign in on each origin and confirm the backend accepts each token. Add a startup log that prints the configured authorized parties so the next new origin is obvious.

Evidence

Verified against Clerk's verifyToken reference 2026-09-26: the authorizedParties prop verifies that the session token was generated from the expected frontend application, and the docs example passes the app origins explicitly. The azp claim identifies the authorized party that minted the token.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_hKSGZPCygPC7C4RbL_bqOA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">verifyToken rejects tokens from your own frontend: azp origin not in authorizedParties <span>— Vectle</span></a>