[PR #7405] [CLOSED] feat(oidc-provider): add support for JWT access tokens and update accessTokenFormat option #7290

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7405
Author: @kilakewe
Created: 1/16/2026
Status: Closed

Base: canaryHead: feat/oidc-refresh-token


📝 Commits (1)

  • 816e68f feat(oidc-provider): add support for JWT access tokens and update accessTokenFormat option

📊 Changes

4 files changed (+230 additions, -3 deletions)

View changed files

📝 docs/content/docs/plugins/oidc-provider.mdx (+4 -0)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+66 -3)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+151 -0)
📝 packages/better-auth/src/plugins/oidc-provider/types.ts (+9 -0)

📄 Description

Summary

Adds optional JWT access tokens for the OIDC Provider via a new accessTokenFormat option (default remains "opaque").

Changes

  • Add accessTokenFormat?: "opaque" | "jwt" to OIDC provider options.
  • When accessTokenFormat: "jwt", sign access tokens using the JWT plugin (iss/aud from JWT plugin config or baseURL) and include sub, azp, scope, iat, exp, jti.
  • Keep existing opaque access token behavior as the default.
  • Update docs + add/extend tests for JWT access token issuance and verification.

Testing

  • Added/updated packages/better-auth/src/plugins/oidc-provider/oidc.test.ts coverage for JWT access tokens.

Summary by cubic

Adds optional JWT access tokens to the OIDC Provider via a new accessTokenFormat option. Default remains opaque; when set to jwt, access tokens are signed via the JWT plugin with standard claims.

  • New Features

    • accessTokenFormat: "opaque" | "jwt" (default "opaque").
    • JWT access tokens use JWT plugin issuer/audience (or baseURL) and include sub, azp, scope, iat, exp, jti.
    • Supported in authorization_code and refresh_token flows.
    • Docs updated; tests added for issuance and JWKS verification.
  • Migration

    • No action needed. To use JWT, enable the JWT plugin and set accessTokenFormat to "jwt".

Written for commit 816e68f37e. Summary will update 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/7405 **Author:** [@kilakewe](https://github.com/kilakewe) **Created:** 1/16/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/oidc-refresh-token` --- ### 📝 Commits (1) - [`816e68f`](https://github.com/better-auth/better-auth/commit/816e68f37e4f21896fb0db8709d049cf8411e470) feat(oidc-provider): add support for JWT access tokens and update accessTokenFormat option ### 📊 Changes **4 files changed** (+230 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oidc-provider.mdx` (+4 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+66 -3) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+151 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/types.ts` (+9 -0) </details> ### 📄 Description ## Summary Adds optional JWT access tokens for the OIDC Provider via a new `accessTokenFormat` option (default remains `"opaque"`). ## Changes - Add `accessTokenFormat?: "opaque" | "jwt"` to OIDC provider options. - When `accessTokenFormat: "jwt"`, sign access tokens using the JWT plugin (iss/aud from JWT plugin config or `baseURL`) and include `sub`, `azp`, `scope`, `iat`, `exp`, `jti`. - Keep existing opaque access token behavior as the default. - Update docs + add/extend tests for JWT access token issuance and verification. ## Testing - Added/updated `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` coverage for JWT access tokens. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds optional JWT access tokens to the OIDC Provider via a new accessTokenFormat option. Default remains opaque; when set to jwt, access tokens are signed via the JWT plugin with standard claims. - **New Features** - accessTokenFormat: "opaque" | "jwt" (default "opaque"). - JWT access tokens use JWT plugin issuer/audience (or baseURL) and include sub, azp, scope, iat, exp, jti. - Supported in authorization_code and refresh_token flows. - Docs updated; tests added for issuance and JWKS verification. - **Migration** - No action needed. To use JWT, enable the JWT plugin and set accessTokenFormat to "jwt". <sup>Written for commit 816e68f37e4f21896fb0db8709d049cf8411e470. Summary will update 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:30:54 -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#7290