Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

authenticate with external/social providers

default discord avatar
lorentzo92last year
4

Hi Everyone, i am studying payload and i would like to propose it to my clients, we are a software house based in Milan, Italy. One thing that is not super clear to me is how to handle auth users calling the cms apis from my nextjs frontend: suppose my client has a dedicated server for managing users and authentication, from nextjs users signup/login using email or social providers and then i have a nextauth session containing the user info. Now how do i combine this with the payload jwt token? I am thinking something like: when a user signup/login, i check if there exist a user with that email in the user collection, if so i (force) login (serverside) to payloadcms with that user and a fixed secret password so that i return the jwt token to pass in future apis against the cms. If the user does not exist then i create a new doc in my user collection and then login. What do you think? Do you have better approaches? Or maybe i am missing something… thanks 🙂

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.