markjaquith / clerk-sveltekit

Clerk adapter for SvelteKit
Other
128 stars 19 forks source link

Calling Clerk server side #45

Open charisra opened 5 months ago

charisra commented 5 months ago

First of all, great package. Secondly, I'd like to ask if this package allows us to call Clerk server-side.

From this section on Readme, first of all I believe locals in reality gives you the userId in session, not the entire Clerk user object, right?

Secondly, let's say I want to programatically create an organization for a user, after he signs up. Can I do it using this package? I noticed that you expose Clerk on the window object, which I can use on client Svelte components. What about server side? Is what I'm getting in locals the only thing I can get from Clerk? And no ability to make calls?

And if so, would I have to use their JS SDK?

Update: Looking deeper into the package code, it seems like on initializeClerkClient you're making clerk available only on the window object. So that means there's no way the package intends to allow use of clerk server side, right?

Dav3whit3 commented 4 months ago

I was looking for the same scenario. Protected routes loado in server side only gives you locals.session.userId. How do I then trigger for example a callback to update user's last_log_date after sign-in?