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.

Controlling Access to Custom Endpoints: Is It Possible?

default discord avatar
paulpopus12 months ago
3

You'll need to handle this logic yourself in custom endpoints, if the request has been authenticated then on the

req

object you'll find

user

if

user

is null then it's unauthenticated



so you can do


if !user then deny
  • default discord avatar
    alienteavend12 months ago

    Ah gotcha, was wondering if there is a solution like the access for collection Configs

  • default discord avatar
    paulpopus12 months ago

    and other logic like


    if !user.isAllowed then deny


    no, for custom endpoints we're giving people full flexibility, since those endpoints could be used for literally anything

  • default discord avatar
    alienteavend12 months ago

    awesome, thanks for the quick answer!

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.