Auth check in +layout.server.ts β known issues?
Hi! π
From working in SvelteKit I've gotten used to avoiding +layout.server.ts for auth checks (reasons illustrated by Svelte connoisseur Hunter Johnston in [1] and [2]), but the Kinde docs uses +layout.server.ts as an example of auth checking [3].
Are there any particular implementation details in Kinde making the issues raised in [1] and [2] null and void?
[1] https://www.youtube.com/watch?v=UbhhJWV3bmI
[2] https://www.youtube.com/watch?v=K1Tya6ovVOI
[3] https://kinde.com/docs/developer-tools/sveltekit-sdk/#check-if-the-user-is-authenticated
5 Replies
Let me check with our SvelteKit expert and get back to you
Hi @andreasb,
The example given in our docs is an example if usage of the
isAuthenticated
method. We are not doing anything special to prevent the case mentioned in the video.
I will look at how we can improve the documentation and examples here to provide more suitable guidance in line with best practices.Thanks for the feedback, both of you! I think it's really neat that you have a SvelteKit SDK, very stoked about it!
Great to hear! feel free to reach out if you have any further questions
Hey @Daniel_Kinde any updates on this? I noticed the documentation still suggest layout for checking isAuthenticated.