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 🙂
We have a blog post that goes into details on how to use auth with Payload for a Next.js app that should help answer your question:
https://payloadcms.com/blog/nextjs-payload-cms-authThere are 2 accompanying repos:
-
https://github.com/payloadcms/next-auth-frontend-
https://github.com/payloadcms/next-auth-cmsThanks for the replies. After rereading the doc i understood that i should add more strategies from passport.js - this answer from a reddit user suggests the same:
https://www.reddit.com/r/PayloadCMS/comments/zevwpi/questions_on_switching_from_strapi_to_payload/?utm_source=share&utm_medium=ios_app&utm_name=ioscss&utm_content=2&utm_term=1hello everyone, Could anyone use it for authentication with Firebase? Since I already have an existing project and also custom claims, and I would like to use the same token for payloadCMS, I could add the data needed for payload inside the token if necessary
Any updates with using next-auth@beta (authjs v5) with payloadcms?
I am on payload v3.5x, ended up making an OIDC connector for payload.
is it opensource?
No
can tell you about it though
Star
Discord
online
Get dedicated engineering support directly from the Payload team.