COCPORN
COCPORN2mo ago

Svelte auth

I... I don't understand the Svelte Convex-library. I don't understand how to add auth to it. Is this setConvexClientContext supposed to be exported? It is declared next to setupContext, but it isn't exported in index.d.ts. Also, the options don't expose the fetchToken-thing. Are there any full examples of auth with Svelte?
3 Replies
ballingt
ballingt2mo ago
setConvexClientContext is not supposed to be exported — you're supposed to use setupContext instead. You can use useConvexClient to get a reference to the client and call .setAuth(() => token) with a function for getting a JWT, but currently there's no example of using auth like this. File an issue at https://github.com/get-convex/convex-svelte/issues to get updates on this, it shouldn't be much to show auth here.
COCPORN
COCPORNOP2mo ago
GitHub
Auth with JWT in Convex Svelte · Issue #13 · get-convex/convex-svel...
I am running into some issues with auth using Convex Svelte. I was directed here from the Convex Discord. I feel like I am so close, so thank you for checking this out. This works: Convex connectio...
COCPORN
COCPORNOP2mo ago
Not sure if this is descriptive enough. Thanks for checking it out!

Did you find this page helpful?