Like what we’re doing? Star us on GitHub!

Is there a global login by rest api?

Iván Dominguez (Domi)
last week
4

Hello community. I want my application that uses payload to have a global login and not by collection. This login should return me a token which would give me access to query all collections.

  • jacobsfletch
    Payload Team
    last week

    Authentication is always per-collection but it sounds like you might want to implement basic access control. If you give your auth-enabled collection a

    roles

    field then controlled access based on its value, you could provide some users with “super-admin” capabilities while restricting the others

  • Iván Dominguez (Domi)
    last week

    hi @jacobsfletch !


    Thanks for your quick response.



    That sounds really good. Do you know where I can configure the collections so that they restrict their access based on a user role?

  • jacobsfletch
    Payload Team
    last week

    Use the

    access

    property on your collection config, here’s an example

    https://github.com/payloadcms/payload/blob/master/examples/auth/cms/src/collections/Users.ts

    and then here’s the doc for reference

    https://payloadcms.com/docs/access-control/overview#access-control
  • Iván Dominguez (Domi)
    last week

    Thank you very much for the info!!

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More