K
Kindeβ€’4mo ago
andreasb

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
4 Replies
onderay
onderayβ€’4mo ago
Let me check with our SvelteKit expert and get back to you
Daniel_Kinde
Daniel_Kindeβ€’4mo ago
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.
andreasb
andreasbβ€’4mo ago
Thanks for the feedback, both of you! I think it's really neat that you have a SvelteKit SDK, very stoked about it!
Daniel_Kinde
Daniel_Kindeβ€’4mo ago
Great to hear! feel free to reach out if you have any further questions