NextAuth redirect after login
Answered
SharpieMaster posted this in #help-forum
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
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
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
I am using t3-stack
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
how would I do this?
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
try this in your login signin method: https://next-auth.js.org/v3/getting-started/client#specifying-a-callbackurl
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
how do I use it?
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
do you ever call
signIn
function?![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
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;
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
now look at the docs that i linked, and you should see what you can pass into signIn...
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
i see
ohhh
for the arguments of the function?
I think i need to edit the default login page
how tho
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
you don't have any options for this
signIn
?![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
like [
signIn(undefined, { callbackUrl: '/account' })
](https://next-auth.js.org/getting-started/client#specifying-a-callbackurl)?Answer
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
no
[no](https://google.com)
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
because when i tried it, this redirects me after sucsessfull...
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
thx
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
uhh, so what fixed it? did adding the signin parms or something else?
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
![Image](https://cdn.discordapp.com/attachments/1157459116474781797/1158219596638212157/image.png?ex=651b738e&is=651a220e&hm=1bfa0690a38843301d141ee254a056690200196cbc147cd65e3cd8515aebfdb9&)
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/aff4eeb34922ca980b0d5fbb5bc60c21.webp?size=256)
risky
oh ok, so this did fix it 🎉
![Avatar](https://cdn.discordapp.com/avatars/484037068239142956/f386ac21405ce3442e0f3598223e1cb3.webp?size=256)
joulev
@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
![Avatar](https://cdn.discordapp.com/avatars/830089505544732674/d50a2dc134522d9629560f70836ed711.webp?size=256)
SharpieMasterOP
sorry, I will not be doing that again