Replies: 3 comments 1 reply
-
Here's some sample code in case anyone wants to help me with this issue: |
Beta Was this translation helpful? Give feedback.
-
I'm also experiencing this on the current versions. And as per the documentation here, it should work. I'm also not seeing this referenced in the v5 documentation at all.
I'm dynamically loading the providers as they are not shared between tenants. And then for convenience I want to pass the "login_hint" so the user can easily go right in if authorized with multiple accounts currently. But this never modifies the provider details as seen from The below two ways of calling signIn have no difference for server side logging of the provider being called.
|
Beta Was this translation helpful? Give feedback.
-
After digging more I figured out what I was doing incorrectly. Which was a dumb mistake. Any provider "extra" prams are the 3rd parameter not the 2nd. And valid parameters can be found in the openid-client package. import { signIn } from "next-auth/react";
// minimum
<button onClick={() => signIn(provider.id)}>Login</button>
// incorrect
// <button onClick={() => signIn(provider.id, { login_hint: "some@email.com" })}>Login w/hint</button>
// correct with extras
<button onClick={() => signIn(provider.id, null, { login_hint: "[email protected]" })}>Login</button> And in my case, I do also need the second param for passing the import { signIn } from "next-auth/react";
<button onClick={() => signIn(
provider.id,
{ callbackUrl: `${window.location.origin}/welcome` },
{ login_hint: "[email protected]" )}
>Login</button> |
Beta Was this translation helpful? Give feedback.
-
According to Next Auth docs, I can pass additional parameters to the
/authorize
endpoint through the third argument ofsignIn()
.There are two examples:
However, there is no full working example and I'm unable to read any additional parameters that I've added in
/api/auth/[...nextauth].js
. Can anyone show me how to read these additional parameters in, for example, thesignIn() callback
?Here's a simple example to illustrate what I mean:
/index.jsx
/api/auth/[...nextauth].js
Output results from signIn() callback:
As you can see, my additional parameter
{addedParam: "My added parameter"}
doesn't show up in any of the objects. How do I read this added parameter in/api/auth/[...nextauth].js
?Beta Was this translation helpful? Give feedback.
All reactions