Correct http status code for resource which requires authorization

后端 未结 8 470
太阳男子
太阳男子 2021-01-29 23:51

There seems to be a lot of confusion about the correct http status code to return if the user tries to access a page which requires the user to login.

So basically what

8条回答
  •  孤独总比滥情好
    2021-01-30 00:45

    I believe 401 is the correct status code to return from failed authorization. Reference RFC 2616 section-14.8 It reads "A user agent that wishes to authenticate itself with a server-- usually, but not necessarily, after receiving a 401 response"

提交回复
热议问题