[PR #6122] [MERGED] feat(jwt): add JWT verification endpoint and refactor verification logic #6463

Closed
opened 2026-03-13 13:00:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6122
Author: @himself65
Created: 11/20/2025
Status: Merged
Merged: 11/21/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/11/19/odci-provider-verify


📝 Commits (4)

  • 94347a2 feat(jwt): add JWT verification endpoint and refactor verification logic
  • 159c297 chore: fix type
  • 0a94505 chore: lint
  • f3eb184 fix: type

📊 Changes

3 files changed (+120 additions, -69 deletions)

View changed files

📝 packages/better-auth/src/plugins/jwt/index.ts (+46 -0)
packages/better-auth/src/plugins/jwt/verify.ts (+65 -0)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+9 -69)

📄 Description

Summary by cubic

Adds a server-only /verify-jwt endpoint and a shared verifyJWT helper to validate JWTs against JWKS and return the payload. OIDC Provider now uses this helper, removing duplicate logic and making verification consistent.

  • New Features

    • POST /verify-jwt accepts { token, issuer? } and returns { payload } where payload can be null.
    • verifyJWT exported from the JWT plugin for programmatic use.
    • Optional issuer override; falls back to plugin options or baseURL.
  • Refactors

    • OIDC Provider replaces its local JWKS verification with jwt.verifyJWT.
    • Removed redundant jose import and verification code.
    • Centralizes JWT verification in the JWT plugin.

Written for commit f3eb184066. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6122 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/20/2025 **Status:** ✅ Merged **Merged:** 11/21/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/11/19/odci-provider-verify` --- ### 📝 Commits (4) - [`94347a2`](https://github.com/better-auth/better-auth/commit/94347a26dd4eded7208b90d82e257ab5bc0c4bdb) feat(jwt): add JWT verification endpoint and refactor verification logic - [`159c297`](https://github.com/better-auth/better-auth/commit/159c2973ad27dc921c6705845a729eb5f6ca6deb) chore: fix type - [`0a94505`](https://github.com/better-auth/better-auth/commit/0a945058bd2f7147fa3b07bbce35d42a2428d3e0) chore: lint - [`f3eb184`](https://github.com/better-auth/better-auth/commit/f3eb18406648c45891ff07461e064b44af852770) fix: type ### 📊 Changes **3 files changed** (+120 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+46 -0) ➕ `packages/better-auth/src/plugins/jwt/verify.ts` (+65 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+9 -69) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds a server-only /verify-jwt endpoint and a shared verifyJWT helper to validate JWTs against JWKS and return the payload. OIDC Provider now uses this helper, removing duplicate logic and making verification consistent. - **New Features** - POST /verify-jwt accepts { token, issuer? } and returns { payload } where payload can be null. - verifyJWT exported from the JWT plugin for programmatic use. - Optional issuer override; falls back to plugin options or baseURL. - **Refactors** - OIDC Provider replaces its local JWKS verification with jwt.verifyJWT. - Removed redundant jose import and verification code. - Centralizes JWT verification in the JWT plugin. <sup>Written for commit f3eb18406648c45891ff07461e064b44af852770. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:00:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6463