Replies: 1 comment 2 replies
-
This question has had a few up-votes but no responses, but if anyone is interested, here's how i'm routing around the problem: // Wrap the NextAuth function in a NextApiHandler
export default async function auth(req: NextApiRequest, res: NextApiResponse) {
// Make sure the req.url is a signin url, so that this only runs on what NextAuth perceives to be a signIn attempt.
// Make sure the req.headers.referer is my custom signUp page
const isSignUp =
req.headers.referer?.includes('/auth/signup') &&
req.url === '/api/auth/signin/email'
? true : false
if (isSignUp) {
// handle sign up flow
return res.status(200).json({message: 'signup successful' )}
}
return await NextAuth(req, res, {
...
});
} This means i can add as many parameters to the This isn't ideal (it means i have to create my own pages, instead of leveraging the really handy NextAuth ones), but it works for my purposes - which include signing up different types of users, each with different form requirements. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question 💬
When Signing up a user, it would be great to be able to add extra parameters to the post request made the the [...nextauth] api endpoint.
How to reproduce ☕️
For example, if i'm using the
email provider
, and i provide a form like the one below:then it would be useful to be able to extract those extra fields on the
signin
callback. For example:This would avoid having to split an onboarding flow into multiple steps as is currently the case:
but instead would condense it into:
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions