Where best to query DB during sign-in flow #3505
-
Hi everyone, I'm new to NextAuth and I've been reading through the docs, the source code, and GitHub discussion forums, but I can't seem to find an answer to my question below. I'm using NextAuth's Google sign-in provider and here's my desired use case:
I've got steps 1, 2, 4, and 5 above working fine, but I'd very much love any help that anyone can provide with where best in the NextAuth sign-in flow to accomplish step 3 above (e.g., is it in the "jwt" callback?). If I'm missing something in the documentation, please let me know. Thank you so much, and I really appreciate it! Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I believe this is sufficiently documented, but correct me if I'm wrong. 1,2 and 5 are out of the box, you don't need to do anything other than calling For 3, I would recommend the https://next-auth.js.org/getting-started/client#specifying-a-callbackurl |
Beta Was this translation helpful? Give feedback.
-
Understood, and thanks again! |
Beta Was this translation helpful? Give feedback.
I believe this is sufficiently documented, but correct me if I'm wrong.
1,2 and 5 are out of the box, you don't need to do anything other than calling
signIn("google")
on the page you want the user to be logged in at. (you can configure where to return by thecallbackUrl
option in the second argument, please check the docs).For 3, I would recommend the
signIn
callback.For 4, I would recommend the
jwt
callback.https://next-auth.js.org/getting-started/client#specifying-a-callbackurl
https://next-auth.js.org/configuration/callbacks