ctx.redirect not working?

When the user is signing in, I want to check for something in the additional fields and redirect based on that. But even this simple redirect script doesn't seem to work.
export const auth = betterAuth({
// other config
hooks: {
after: createAuthMiddleware(async (ctx) => {
if (ctx.path.startsWith('/sign-in')) {
console.log("Redirecting to /test");
throw ctx.redirect('/test');
}
}),
}
})
export const auth = betterAuth({
// other config
hooks: {
after: createAuthMiddleware(async (ctx) => {
if (ctx.path.startsWith('/sign-in')) {
console.log("Redirecting to /test");
throw ctx.redirect('/test');
}
}),
}
})
1 Reply
remakker
remakkerOP5w ago
ping @Ping, or @bekacru

Did you find this page helpful?