A new JWT is minted for every request to getSession #1316

Closed
opened 2026-03-13 08:32:30 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @widavies on GitHub (Jun 5, 2025).

The JWT plugin will mint a new JWT every-time getSession is called: 91d504d81b/packages/better-auth/src/plugins/jwt/index.ts (L389)

Is there a way to control when the JWT is minted? I don't need a new JWT every-time it is invoked. Maybe a query parameter?

Originally created by @widavies on GitHub (Jun 5, 2025). The JWT plugin will mint a new JWT every-time `getSession` is called: https://github.com/better-auth/better-auth/blob/91d504d81bcea52a6785eec02dca1626f2b734e6/packages/better-auth/src/plugins/jwt/index.ts#L389 Is there a way to control when the JWT is minted? I don't need a new JWT every-time it is invoked. Maybe a query parameter?
Author
Owner

@dosubot[bot] commented on GitHub (Sep 4, 2025):

Hi, @widavies. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that the JWT plugin generates a new token on every call to getSession.
  • You inquired about options to control or limit token minting, such as using a query parameter.
  • The goal is to avoid unnecessary creation of new JWTs.
  • There have been no comments or responses on this issue so far.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting here.
  • If I don’t hear back within 7 days, this issue will be automatically closed.

Thanks for your understanding and contribution!

@dosubot[bot] commented on GitHub (Sep 4, 2025): Hi, @widavies. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that the JWT plugin generates a new token on every call to `getSession`. - You inquired about options to control or limit token minting, such as using a query parameter. - The goal is to avoid unnecessary creation of new JWTs. - There have been no comments or responses on this issue so far. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting here. - If I don’t hear back within 7 days, this issue will be automatically closed. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1316