v3 RFC: Request handling #1284
pilcrowonpaper
started this conversation in
General
Replies: 1 comment 3 replies
-
Hi! I just stumbled across this repo while building my very own auth library which looks surprisingly similar. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm not sure if this should be part of v3 or v4, but since it doesn't change existing v3 changes, I thought it might be fine to be part of the next update.
Anyway, this RFC proposes to remove middleware and remove the caching feature from
AuthRequest.validate()
. This makes the API more simple and the behavior predictable.Changes
Remove middleware
Making sure
handleRequest()
is properly typed based on the middleware sucks,s and it's impossible to properly document it in the API reference. Instead of middleware, we'll provide framework specificRequestContext
, similar to adapters.Remove caching feature
AuthRequest.validate()
andAuthRequest.validateBearerToken()
currently caches the result so you can call it multiple times without making multiple database calls. But like the famous saying, caching sucks. This would make documenting the API easier as well. (validate()
will be renamed tovalidateSessionCookie()
)Move CSRF protection option
Right now, options for CSRF protection is globally defined:
It'd made more sense to move it within
AuthRequest
.Migration steps
For projects that don't utilize the caching feature, it'll be simple as replacing the middleware.
SvelteKit
Astro
Beta Was this translation helpful? Give feedback.
All reactions