You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wanted to contribute with something that I've been struggling the last couple of days.
So the way that I'm using this package is I have the following code:
// hooks.server.tsexportconsthandle: Handle=sequence(awaithandleClerk(CLERK_SECRET_KEY,{debug: NODE_ENV==='development',protectedPaths: ['/dashboard'],signInUrl: route('/login')}),async({ event, resolve })=>{letrepository=newUnauthenticatedPrismaRepository();if(event.locals.session?.userId){constauthUser=awaitrepository.getUserByExternalId(event.locals.session?.userId);repository=newAuthenticatedPrismaRepository(authUser);event.locals.authUser=authUser;// ⚠️ I care about my own user model, not clerks data...}event.locals.repository=repository;returnresolve(event);});
And then in my "frontend-side" components I use the export let data: PageData method to grab the authUser and get the auth details from the server.
My problem was that after signing in and get redirected, the server won't have the cookie and the clerk user data, but the frontend will. And this lib doesn't expose a callback outside a svelte template that will allow my server to send this data after the authentication has happened.
But after diving into the code, I found that a custom event was being sent. So after putting this together all my problems were solved. So I thought of sharing this in case it helps someone else.
Hi folks, thanks for creating this wonderful lib.
I just wanted to contribute with something that I've been struggling the last couple of days.
So the way that I'm using this package is I have the following code:
And then in my "frontend-side" components I use the
export let data: PageData
method to grab the authUser and get the auth details from the server.My problem was that after signing in and get redirected, the server won't have the cookie and the clerk user data, but the frontend will. And this lib doesn't expose a callback outside a svelte template that will allow my server to send this data after the authentication has happened.
But after diving into the code, I found that a custom event was being sent. So after putting this together all my problems were solved. So I thought of sharing this in case it helps someone else.
The text was updated successfully, but these errors were encountered: