[GH-ISSUE #428] Enhance definePayload method in jwt plugin #16900

Closed
opened 2026-04-15 14:52:37 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @svaraborut on GitHub (Nov 5, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/428

Is your feature request related to a problem? Please describe.
When creating a JWT it may also be needed to embed session-related info (like activeOrganizationId).

Describe the solution you'd like
definePayload signature shall be (user: User, session: Session) => Promise<...>

Originally created by @svaraborut on GitHub (Nov 5, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/428 **Is your feature request related to a problem? Please describe.** When creating a JWT it may also be needed to embed session-related info (like `activeOrganizationId`). **Describe the solution you'd like** `definePayload` signature shall be `(user: User, session: Session) => Promise<...>`
GiteaMirror added the locked label 2026-04-15 14:52:37 -05:00
Author
Owner

@kziemski commented on GitHub (Dec 14, 2024):

line where we would pass the session?
It actually looks like we would only need to pass the session that we reference the user from right?

<!-- gh-comment-id:2543338585 --> @kziemski commented on GitHub (Dec 14, 2024): [line where we would pass the session?](https://github.com/better-auth/better-auth/blob/bf522217d7c00ce40ed49edbcd3131b977fb8f1f/packages/better-auth/src/plugins/jwt/index.ts#L233) It actually looks like we would only need to pass the session that we reference the user from right?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16900