-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signIn callback does nothing when returning an object #751
Comments
@iaincollins If you have a moment - could you please comment here. Is this an issue, an issue with docs or just an issue with me doing something wrong. Thanks! |
Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep it open. (Read more at #912) Thanks! |
I believe this is an issue with the documentation. We should probably update it to reflect the real behavior. Or do the opposite and make the code do what the docs says. |
@balazsorban44, it would be convenient to be able to return a set of properties that get appended to the JWT. Right now, I get around by appending a new property to the |
All right, I guess it should not be hard to forward the response from line 71 to the jwt callback. We only check if the response is explicitly false or an error anyway. I'm going to make a PR for this, and discuss with the others. I'll keep you updated. UPDATE: Meaning the error is in the docs, and the intended place to modify the jwt is only the When that said, looking at the code below: next-auth/src/server/routes/callback.js Lines 70 to 92 in 8115a7c
it doesn't look like that we can actually return a string url at the moment. Only Either way, there is something wrong with either the docs or the code, but for you the important part is that you should only modify the jwt in the |
Updated the code to handle returned strings correctly, and changed the docs that wrongly suggested that you can return a modify JWT. To reiterate, all JWT modifications should be done in the |
Describe the bug
In the documentation for
signIn
callback (https://next-auth.js.org/configuration/callbacks#sign-in-callback) I see that it should be possible to returnThis leads me to believe that if I return some kind of object:
Then this would get propagated the the jwt. This does not appear to be the case if you look at the code:
https://github.com/nextauthjs/next-auth/blob/main/src/server/routes/callback.js#L71
The only thing that happens with the result is that it's checked to see if it's
false
Steps to reproduce
foo: "bar"
) from thesignIn
callbackjwt
callback methodExpected behavior
foo: "bar"
should appear as one of the properties in thejwt
callbackFeedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: