Better AuthBA
Better Auth11mo ago
Dev

React Router v7 Integration

I want to add auth in react router v7 app, the better-auth docs only mention the integration for Remix, so i tried using that but it didnt work

im new to react router / remix and dont know how to make it work

the below method mentioned in remix integration docs gives 405 error on form submission
// POST http://localhost:5173/api/auth/sign-up/email 405 (Method Not Allowed)
const signUp = async () => {
        await authClient.signUp.email(
            {
                email,
                password,
                name,
            },
            {
                onRequest: () => {
                    console.warn("Sign up Initiated...");
                },
                onSuccess: () => {
                    alert("Successfully signed up!");
                },
                onError: (ctx) => {
                    alert(ctx.error);
                },
            }
        );
    };
Was this page helpful?