What HTTP code to use in “Not Authenticated” and “Not authorized” cases?

后端 未结 4 990
死守一世寂寞
死守一世寂寞 2021-02-03 23:34

I read that \"401 Unauthorized\" code must be used when a user:

  1. Is not logged, but login is required (\"not authenticated\");
  2. Is logged, but his profile d
4条回答
  •  猫巷女王i
    2021-02-03 23:59

    IIS differentiates these cases with sub-status codes (reference):

    • 401 = User is not logged in, but login is required
    • 401.1 = The user tried to login but their credentials are not valid.
    • 401.3 = The user's credentials are valid but the user is not authorized to see the resource.

提交回复
热议问题