[PR #5812] [MERGED] feat(jwt): support custom adapter option for jwt #6243

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5812
Author: @Bekacru
Created: 11/6/2025
Status: Merged
Merged: 11/6/2025
Merged by: @Bekacru

Base: canaryHead: feat/jwt-adapter


📝 Commits (2)

📊 Changes

8 files changed (+156 additions, -17 deletions)

View changed files

📝 docs/content/docs/plugins/jwt.mdx (+26 -0)
📝 packages/better-auth/src/plugins/jwt/adapter.ts (+21 -6)
📝 packages/better-auth/src/plugins/jwt/index.ts (+8 -3)
📝 packages/better-auth/src/plugins/jwt/jwt.test.ts (+39 -1)
📝 packages/better-auth/src/plugins/jwt/sign.ts (+5 -2)
📝 packages/better-auth/src/plugins/jwt/types.ts (+47 -3)
📝 packages/better-auth/src/plugins/jwt/utils.ts (+2 -2)
📝 packages/core/src/types/plugin.ts (+8 -0)

📄 Description

Summary by cubic

Adds a custom adapter option to the JWT plugin so you can store and manage JWKS outside the database (e.g., Redis, external services, in-memory). Default behavior stays the same.

  • New Features
    • New jwt.options.adapter with getJwks(ctx), getLatestKey(ctx), and createJwk(data, ctx).
    • Adapter methods receive GenericEndpointContext for request-aware logic.
    • Core plugin types now support an adapter override.
    • Docs updated with a “Custom Adapter” example.

Written for commit ea19399abf. 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/5812 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 11/6/2025 **Status:** ✅ Merged **Merged:** 11/6/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `feat/jwt-adapter` --- ### 📝 Commits (2) - [`c8fcbed`](https://github.com/better-auth/better-auth/commit/c8fcbed9b22d4839de47861ddb5b7809f5c8b7e8) feat(jwt): allow adapter option for jwt - [`ea19399`](https://github.com/better-auth/better-auth/commit/ea19399abfa9fdff7242546685bbe033639e2641) add test ### 📊 Changes **8 files changed** (+156 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/jwt.mdx` (+26 -0) 📝 `packages/better-auth/src/plugins/jwt/adapter.ts` (+21 -6) 📝 `packages/better-auth/src/plugins/jwt/index.ts` (+8 -3) 📝 `packages/better-auth/src/plugins/jwt/jwt.test.ts` (+39 -1) 📝 `packages/better-auth/src/plugins/jwt/sign.ts` (+5 -2) 📝 `packages/better-auth/src/plugins/jwt/types.ts` (+47 -3) 📝 `packages/better-auth/src/plugins/jwt/utils.ts` (+2 -2) 📝 `packages/core/src/types/plugin.ts` (+8 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds a custom adapter option to the JWT plugin so you can store and manage JWKS outside the database (e.g., Redis, external services, in-memory). Default behavior stays the same. - **New Features** - New jwt.options.adapter with getJwks(ctx), getLatestKey(ctx), and createJwk(data, ctx). - Adapter methods receive GenericEndpointContext for request-aware logic. - Core plugin types now support an adapter override. - Docs updated with a “Custom Adapter” example. <sup>Written for commit ea19399abfa9fdff7242546685bbe033639e2641. 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 12:52:11 -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#6243