Skip to content

feat(server): add resource option to verifyClerkToken for audience binding - #38

Draft
djgould wants to merge 1 commit into
mainfrom
devin/verify-clerk-token-resource
Draft

djgould wants to merge 1 commit into
mainfrom
devin/verify-clerk-token-resource

Conversation

@djgould

@djgould djgould commented Sep 16, 2026

Copy link
Copy Markdown

Description

verifyClerkToken(auth, token, { resource }) now fails closed when the token's aud does not include resource, for JWT and opaque tokens alike, and sets resource on the returned AuthInfo. Without resource, behavior is unchanged.

  • Relies on the aud field of the OAuth auth object added to @clerk/backend in feat(backend): enforce audience binding for OAuth access tokens javascript#9794. The @clerk/backend devDependency here is still v2, so aud is read structurally; bump it and drop the cast once that ships. With an older @clerk/backend, setting resource rejects every token.
  • The Next.js README example passes resource derived from the request origin.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

…nding

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@djgould
djgould force-pushed the devin/verify-clerk-token-resource branch from 12cb935 to 4f3224c Compare September 16, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant