Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • I do like the clear separation. In fact, I would make it even more explicit and have part of the path be public (unauthenticated traffic), private (authenticated traffic), or admin (administration traffic) so no mix-up is possible. Commented Jun 3, 2025 at 12:55
  • @MatthieuM. And then your business rules changes and you have to clean up a mess of paths 😅 . Commented Jun 3, 2025 at 14:22
  • 2
    @DavidMulder: I could see public-vs-private being blurry -- specifically, I could public endpoints becoming private -- but opening admin endpoints to the general public is a terrible idea in general, security-wise: you're better off redoing a new endpoint from scratch. Commented Jun 3, 2025 at 14:24
  • 2
    @GregBurghardt I don't have a problem with /api/users/current . Even have done it myself, although I guess in a perfect world one might not do it. It did end up in the same codepath though as admin level user updates (just an if id equals 'current' then id = currentUserId). My comment was purely in response to Matthieu M's comment with which I did strongly disagree. Commented Jun 3, 2025 at 15:06
  • 1
    @AaronDufour - you would be absolutely correct. I updated my answer. The description of a 401 is "unauthorized" when they really meant "unauthenticated". At least, to me, unauthorized means you are authenticated, but you lack permission. Commented Jun 4, 2025 at 12:10