Next.js Discord

Discord Forum

NextAuth.js with External Backend

Unanswered
Capelin posted this in #help-forum
Open in Discord
CapelinOP
Hi, I have a question regarding the usage of NextAuth.js in conjunction with another backend framework like Express or Nest.js. Specifically, I'd like to know how to utilize the Google provider in NextAuth.js to verify a user's Gmail account and subsequently use the credentials obtained from this provider to register the user in my backend application.

Thank you for your assistance!

3 Replies

West African Lion
Hey there. Similar issue here! We'd like to take advantage of the work NextAuth has done with regards to its various supported auth methods (Google, Github, Discord, Email, Credentials, etc), but we'd like to authenticate into our own custom (GraphQL) backend.

I was hoping nextauth provided a hook where we could take over and authenticate with our own backend, but I'm not finding anything like this.
West African Lion
Here's an article that seems to provide some instructions, but it's only for the Credentials Provider: https://cloudcoders.xyz/blog/nextauth-credentials-provider-with-external-api-and-login-page/
I particularly need this for the email (magic link) provider, but no examples found for that.