metadata in next-auth

in next-auth is it possible to add metadata for special authrozations?
signIn('google', { metadata: {code: "extra data here"}))
signIn('google', { metadata: {code: "extra data here"}))
and I want to get this metadata in session
callbacks: {
session: async ({ session, token }) => {
console.log(session.metadata.code)

return session
},
callbacks: {
session: async ({ session, token }) => {
console.log(session.metadata.code)

return session
},
it would be nicer if I can get that metadata in createUser
1 Reply
Thaun_
Thaun_13mo ago
I think you could either use callbackurl on signin, or overriding state, and then read it on signin callback.
signIn("google", { callbackUrl: "" }, { state: "" });
signIn("google", { callbackUrl: "" }, { state: "" });
Want results from more Discord servers?
Add your server