Let's say you have an online store or app that uses payload what would be the easiest way to manage user/customer logins is there a built-in system or a commonly used workaround?
the expectation is that customers/users would not be able to access the CMS but would be able to log in via a separate login page, interacting with payload operations they have access to?
PS: thanks in advance just learning payload so far it's been amazing! super excited to use it in my current and future projects!
you can create users with different access rights. you don't have to give them access to the admin at all or a limited admin panel.
if you wanna check out the ecommerce template for example, there's a login form in the frontend, that uses the auth of payload, but doesn't give them access to the admin panel
Hey amazing! Thank you!
Edit: payload ecommerce template has an example of exactly what I was looking for.
solution:
access: {
read: adminsAndUser,
create: anyone,
update: adminsAndUser,
delete: admins,
admin: ({ req: { user } }) => checkRole(['admin'], user),
},
Example for implementing auth context on nextjs/react using Content (from ecommerce )
thank you for linking resources, came here from discord search and this is exactly what i needed :)
Star
Discord
online
Get dedicated engineering support directly from the Payload team.