Replies: 8 comments 16 replies
-
Hi, would #823 solve this issue? |
Beta Was this translation helpful? Give feedback.
-
There is a temporary workaround that can be used to achieve this! Before this handler in your file: Add a method that sets a cookie:
Now in [...nextauth].ts, we need to make change such that authOptions is just a function that returns next-auth callbacks and config like:
|
Beta Was this translation helpful? Give feedback.
-
Any update on this ? Here is an example of use : Allow a new user to specify its username on signup. Currently, I believe I have to do this in a separate step. EDIT: So I can just do that : And inside the signIn callback : To access the request object, you need to use the nextAuth advanced initialization : https://next-auth.js.org/configuration/initialization |
Beta Was this translation helpful? Give feedback.
-
I'm not able to pass any parameters using the above solutions. any workarounds as of today? |
Beta Was this translation helpful? Give feedback.
-
for strava provider with nextauth5 beta, I can pass parameters like this (they will be sent as get params in url to strava when initation oauth), maybe it works similar with other providers providers: [
Strava({
clientId: process.env.STRAVA_CLIENT_ID,
clientSecret: process.env.STRAVA_CLIENT_SECRET,
authorization: {
params: { scope: 'read,activity:read' }
}
})
], |
Beta Was this translation helpful? Give feedback.
-
is this fixed already in V5? |
Beta Was this translation helpful? Give feedback.
-
It doesn't work as a URL parameter but you can leverage cookies and pass it as a cookie then access it from Example:
spent an awful lot of time trying to do this in a cleaner matter this use case should be better handled |
Beta Was this translation helpful? Give feedback.
-
For those using const isSignUp = true; // some state value to handle signup or login
// toggle nextauth
signIn(
"auth0",
{ callbackUrl },
{ screen_hint: isSignUp ? "signup" : "login" }
) signIn<RedirectableProviderType | undefined>(provider?: LiteralUnion<BuiltInProviderType> | undefined, options?: SignInOptions, authorizationParams?: SignInAuthorizationParams): Promise<SignInResponse | undefined> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Your question
How can I pass additional parameters to signIn with email function to use on callback?
Cant find passed values on the sign in callback
What are you trying to do
Im trying to add an additional "name" parameter to the signIn() function, along with the email and callback url.
Currently Im using the prisma adapter and would like to add a value to the native "name" property that the schema requires you to have.
Feedback
https://next-auth.js.org/schemas/adapters
https://next-auth.js.org/getting-started/client#signin
signIn("email", { email: email, callbackUrl: userCallbackUrl, name: 'Test Name', })
Beta Was this translation helpful? Give feedback.
All reactions