Skip to content
Discussion options

You must be logged in to vote

An auth helper like this might not be reliable when combined with other loading mechanisms (which could happen as separate requests that will not be intercepted).

It might be OK as a remote function, as those should all be executed together on the server before returning when using remote functions exclusively. Though with remote functions, those should be protected on their own to prevent bypasses, so you probably would not call the utility directly but have each remote functions call it. (Because there can be many such functions, I opened an issue about module-level protection a while ago.)

If you are not going with remote functions, you probably should still stick to hooks.server.ts to…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@brunnerh
Comment options

Comment options

You must be logged in to vote
1 reply
@islamzaoui
Comment options

Answer selected by islamzaoui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants