Replies: 2 comments 6 replies
-
The My suggestion would be that you save the result of export default function auth(req, res) {
let user_authenticated = null
NextAuth(req, res, {
// ...
callbacks: {
signIn(user) {
user_authenticated = await user_web_authentication(user.email)
// If true, will continue, otherwise signing in will be denied
return Boolean(user_authenticated?.success)
},
jwt(token, user) {
if (user) { // Initial invocation
token.user.id = user_authenticated.profile.id
// ...
}
return token
}
}
})
} The
Suggestion: It is generally good practice to paste actual code, instead of images. It's easier to read/copy/test. See: Creating and highlighting code blocks |
Beta Was this translation helpful? Give feedback.
-
Actually is a good idea, I will try it it seems pretty straightforward and
let the session object small
…On Sat, 31 Jul 2021, 08:31 aboveyunhai, ***@***.***> wrote:
@bilalesi <https://github.com/bilalesi> I was thinking about setting the
jwt token (from your backend) as one of the data field in the generated
token (by next auth).
Then we don't need to put the jwt token into session, instead use
useToken() to decrypt the next auth token, then get the true backend
token there and do further action. Not sure if this is better than simply
passing the backend towen into session.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2400 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUCWGKIBXPLWDAO2ERHDKLT2ORELANCNFSM5ATG7Z6A>
.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question 💬
Hi team,
i want to thank you first for the amazing work you're doing
first i am trying to implement password-less authentication, and for that purpose i have already a backend that generate jwt tokens (due the app has multiple sub-apps and the jwt generator must be centralize)
i want to get the jwt from the server and replace the jwt generatad in jwt callback, i tried to use the signin callback to replace the accessToken but it seams not working
is there anything to do to use my own jwt token instead of the auto-generated by next-auth
thank you
How to reproduce ☕️
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Beta Was this translation helpful? Give feedback.
All reactions