Svelte Kit SSR Bearer Token Guidance

We’ve long run a Svelte app using @auth0/auth0-spa-js. We’re in the middle of migrating to Svelte Kit where we now have access to SSR and the server-side API’s. Much like next, things get a bit more complicated in the spa/ssr world. needless to say, I’d love to make sure I’m doing things correctly.

While I know there is a next library, what’s the recommended approach to implement auth0 in Svelte Kit? My biggest hurdle right now is accessing the access_token in SSR such that we can use that to call our backend api.

2 Likes

very interested in the exact same use case. we’ve been looking into the nextjs approach, but it’s different enough from sveltekit that a direct port is proving challenging.

would be very interested to hear if there are plans for any ‘official’ sveltekit tutorials, SDK, etc. as we are all in on SvelteKit and really want to use Auth0 as basis for authentication in our platform

patrickneise Check out how we wrapped things to use it on our platform ( https://that.us ) that.us/src/_utils/security at master · ThatConference/that.us · GitHub but I’d sure love an official package.

Please go in and upvote request for official SDK for Sveltekit.

1 Like

Last week I managed to integrate it fairly easily without any frameworks. Less dependencies to manage as well

https://wordpress.com/post/dejanvasic.wordpress.com/1031