You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{getCsrfToken}from"next-auth/react"exportdefaultfunctionSignIn({ csrfToken }){return(<formmethod="post"action="/api/auth/signin/email">{/**Being able to add the following hidden input, and have it parsed on the server and added to the redirect on succesful signins: */}<inputname="callbackUrl"type="hidden"defaultValue='/custom/callback/url'/><inputname="csrfToken"type="hidden"defaultValue={csrfToken}/><label>
Email address
<inputtype="email"id="email"name="email"/></label><buttontype="submit">Sign in with Email</button></form>)}// This is the recommended way for Next.js 9.3 or newerexportasyncfunctiongetServerSideProps(context){constcsrfToken=awaitgetCsrfToken(context)return{props: { csrfToken },}}/*// If older than Next.js 9.3SignIn.getInitialProps = async (context) => { return { csrfToken: await getCsrfToken(context) }}*/
How to reproduce ☕️
Currently the only way to specify a custom callbackUrl is by using the signin('email', {callbackUrl: '/someurl'}) hook.
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
This discussion was converted from issue #3870 on February 12, 2022 23:40.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description 📓
A nice-to-have feature would be the ability to set the callbackUrl as a field in the form on a custom signIn page.
using the example from the documentation:
How to reproduce ☕️
Currently the only way to specify a custom
callbackUrl
is by using thesignin('email', {callbackUrl: '/someurl'})
hook.Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
Beta Was this translation helpful? Give feedback.
All reactions