-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remix Server Side Auth #90
Comments
No immediate plans -- current focus is on React + Next.js. SSA support for Next.js is still experimental, so that would need to stabilize before tackling SSA for other frameworks |
Waiting for this :) |
In the Next.js implementation the cookie is set in https://github.com/get-convex/convex-auth/blob/main/src/nextjs/server/cookies.ts#L75 in the Next.js implementation because it sets cookies https://github.com/get-convex/convex-auth/blob/main/src/nextjs/server/index.tsx#L250-L254 |
Hi guys! I really enjoy using convex and convex auth and I would also love to see this implemented. I had a brief chat with @thomasballinger on discord about this issue. (thread here) Essentially, as Remix users, we need a way to fetch the token in the loader so we can access authenticated APIs from there. I experimented with using the primitives provided by Convex Auth to create a component that handles authentication on the client-side, hoping to still leverage Remix's server mode while keeping the authentication logic in the client. Here's an example of the component I created: export function Authenticated({ children }: { children: React.ReactNode }) {
const { generatePath } = useLocale();
return (
<>
<AuthLoading>
<div className={"flex justify-center items-center h-screen"}>
<LoadingSpinner size={36} />
</div>
</AuthLoading>
<ConvexUnauthenticated>
<Navigate to={generatePath(routes.signIn)} />
</ConvexUnauthenticated>
<ConvexAuthenticated>
<AuthenticatedProvider>{children}</AuthenticatedProvider>
</ConvexAuthenticated>
</>
);
} While this approach works in SPA mode, it triggers an error and some unexpected behaviors when running in server mode, as shown in the screenshot below: Sadly running in SPA mode is blocking me from using some libs such as remix-i18next which depend on the loader Has anyone else tried to implement client auth handling in remix? |
Is there a plan to implement SSA for Remix?
The text was updated successfully, but these errors were encountered: