siingers
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
Will give this a try over the weekend!
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
There's been an update for the clerk-sveltekit repo, it's currently still a PR but the author has made it available on npm.
Upgrades to Clerk-Core 2 and adds refactors a bunch that makes more sense.
https://github.com/markjaquith/clerk-sveltekit/pull/60#issuecomment-2313478868
135 replies
CCConvex Community
•Created by siingers on 8/27/2024 in #support-community
Clerk Webhook for User Creation - is this really suitable?
gotcha, always appreciated
7 replies
CCConvex Community
•Created by siingers on 8/27/2024 in #support-community
Clerk Webhook for User Creation - is this really suitable?
I've been using auth.getUserIdentity() in my queries, but I appreciate the advice! The clerk-sveltekit library makes the user object available server side after sign-in so perhaps I can handle it there.
e.g. new user signs-up via clerk, clerk hook redirects them to the afterSignUpUrl, a server-side page load function uses the Clerk User object that's been injected into the locals.session, a Convex mutation checks getUserIdentity() and creates the user table entry.
Or is locals.session unsafe?
https://github.com/markjaquith/clerk-sveltekit?tab=readme-ov-file#using-clerk-data-on-the-server
7 replies
CCConvex Community
•Created by siingers on 8/27/2024 in #support-community
Clerk Webhook for User Creation - is this really suitable?
In sveltekit I'm thinking of using the afterSignUpUrl option of the clerk hook to create the User record in convex based on the Clerk User object. Not sure how it's done in the react solution.
7 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
I got clerk working with it - see my message above. But for lucia I did find this: https://github.com/get-convex/convex-lucia-auth-demo
Maybe that can get you on the right track
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
would like to get your opinion on my implementation though - all I had to do is:
1. have clerk-sveltekit configured
2. onMount, in the root +layout.svelte, attach a listener for the custom event that clerk-sveltekit fires whenever the clerk user object changes ("clerk-sveltekit:user") to the document,
3. pass the fetchToken function to the ConvexClient (assigned via useConvexClient() ),
4. and obviously have the convex/auth.config.ts configured & pushed
Currently it runs everytime the window is observed, and isn't checking for the user state, but I'll put a check in place for that.
Not 100% sure this needs to happen in layout.svelte, but I feel limited as the Clerk-Sveltekit package doesn't expose the store they use (there's a pull request to do this plus a lot more updating). Would like to know your thoughts
Haven't tried implementing Convex Auth or anything else, i.e. Auth.js or Lucia
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
missed this message but appreciate the offer either way 👍
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
once I've refactored as it's not the best implementation at the moment
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
@ballingt I've got it working! I'll put a post together as promised to guide others
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
No problem! Let me know if you find a minute tomorrow and good luck with the episode
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
Will be home from 6pm BST if that works for you, just give me a heads up
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
this afternoon would be great! I'm in the UK & just finishing up work. Not sure what timezone you're in?
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
Not having a great time in all honesty. Would be great if the docs were fleshed out, not really sure what's the point in having other SDKs if authentication docs only care for react & next.
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
I’m putting together what I’ve learned this weekend, I’ll message you a link when it’s ready!
135 replies
CCConvex Community
•Created by siingers on 8/15/2024 in #support-community
sveltekit & authentication
I think I understand a bit more now - convex-svelte uses the convexClient lib so I need to log the user in with Clerk, then setAuth on the convexClient, using clerk's getAuth to return the token in the Convex JWT template format
https://discord.com/channels/1019350475847499849/1268719872171311125/1268835776591040522
135 replies
CCConvex Community
•Created by Sam Whitmore on 7/11/2024 in #support-community
Convex Auth: Implementation with Svelte(Kit)
the docs state you should use a hook from their react library to check for logged-in/out status on the backend over checking with clerk. Did you have any issues handling this?
https://docs.convex.dev/auth/clerk#logged-in-and-logged-out-views
18 replies