Providing additional fields when signing up via magic link
Hey there, when I sign up via magic link from the client with the code below I'm not able to pass custom / additional user fields (i.e. firstName, lastName). Or do I miss anything?
const { error } = await authClient.signIn.magicLink({
email: data.email,
callbackURL: returnUrl,
name:
${data.firstName} ${data.lastName}
,
})3 Replies
also not able to find a way around this with hooks or something :/
I think for now you need to use a callback URL to take the user to a form
If you really want to collect the info upfront (assuming you're using next actions/react router):
1) send the additional fields up to the server with the users email
2) save the field values in an encrypted cookie, and then call the send magic link API on the server to send the email.
3) when the user hits the callback route you can read the cookie, update the user and then destroy the cookie afterwards