RFC: Cookies Adapter #9500
ThangHuuVu
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Adapter
abstraction instead of branching on JWT/database strategies.adapter-cookies
package to use Auth.js. The developer may still use another DB adapter to persist the data elsewhere.Non-Goals
Background
Adding authentication with Auth.js is minimal (doesn't require an adapter) and secure by default thanks to the JWT session cookies implementation. To further simplify the core's functionality and ease of maintenance, we would like to introduce the
CookiesAdapter
to unify the abstraction between thejwt
and thedatabase
strategy in the core.This is a core refactoring - for the developers, the change should be ideally invisible. Auth.js core will use this new adapter as the default under the hood, and the configurations for JWT via
authOptions.jwt
should remain unchanged.This would however leave some chance to rethink the JWT callback (it's getting a bit bloated) in the follow up PRs. The breaking changes, if any, should be introduce later on there.
Proposal
The logic to handle JWT strategy will be moved to the
CookiesAdapter
file. While moving stuff around, we want to make sure that the tests are still passing for both/session
and/callback
, as the authentication flow should remain unchanged.Beta Was this translation helpful? Give feedback.
All reactions