Tuzemec
Explore posts from serversBABetter Auth
•Created by Tuzemec on 4/14/2025 in #help
Anyone managed to create a server side protected route?
I'm having a set of routes that need to be accessible only when the user is authenticated.
As per the documentation, I'm trying to create a function that runs on the server.
https://docs.solidjs.com/solid-start/advanced/auth#protected-routes
I guess it will be enough to check if
better-auth.session_token
cookie is set.
But how do I get access to the cookies in the server side running function?
If I try to use auth.api.getSession()
I need to pass headers. And how do I do that too?
I guess, at the end I should fall back to the client-only authentication, but what's the point of the whole server-side thing... :/12 replies
Context and HMR
Hi,
I'm having a small issue with the combination of context consumer and HMR.
Example here: https://stackblitz.com/edit/solidjs-templates-wf2avx?file=src%2FContextConsumer.tsx
(The same happens locally too)
Basically when you edit the
ContextConsumer
the context value is lost during HMR.
Is that something expected? I found an old similar issues on github:
https://github.com/solidjs/solid-refresh/issues/14 but I don't see a resolution.
Am I missing something?4 replies