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.

Is there a global login by rest api?

default discord avatar
ivandominguezdomi2 years ago
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.

  • discord user avatar
    jacobsfletch
    2 years ago

    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

  • default discord avatar
    ivandominguezdomi2 years ago

    hi

    @808734492645785600

    !


    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?

  • discord user avatar
    jacobsfletch
    2 years ago

    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
  • default discord avatar
    ivandominguezdomi2 years ago

    Thank you very much for the info!!

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.