NextAuth redirect after login
Answered
SharpieMaster posted this in #help-forum
I want it to redirect the user to /account after login instead of /
Answered by risky
like [
signIn(undefined, { callbackUrl: '/account' })
](https://next-auth.js.org/getting-started/client#specifying-a-callbackurl)?25 Replies
I am using t3-stack
how would I do this?
try this in your login signin method: https://next-auth.js.org/v3/getting-started/client#specifying-a-callbackurl
how do I use it?
do you ever call
signIn
function?yes
"use client";
import React from "react";
import { signIn } from "next-auth/react";
const SignInButton = () => {
return (
<button
onClick={() => {
signIn();
}}
>
Sign In
</button>
);
};
export default SignInButton;
now look at the docs that i linked, and you should see what you can pass into signIn...
i see
ohhh
for the arguments of the function?
I think i need to edit the default login page
how tho
you don't have any options for this
signIn
?like [
signIn(undefined, { callbackUrl: '/account' })
](https://next-auth.js.org/getting-started/client#specifying-a-callbackurl)?Answer
no
[no](https://google.com)
because when i tried it, this redirects me after sucsessfull...
thx
uhh, so what fixed it? did adding the signin parms or something else?
oh ok, so this did fix it 🎉
@SharpieMaster this is not the first time you do this. Please only use this for messages that answer your question (your message or other people’s), not “thanks†or irrelevant messages
sorry, I will not be doing that again