Understanding 403 Forbidden
There’s a problem with 401 Unauthorized, the HTTP status code for authentication errors. And that’s just it: it’s for authentication, not authorization. Receiving a 401 response is the server telling you, “you aren’t authenticated–either not authenticated at all or authenticated incorrectly–but please reauthenticate and try again.” To help you out, it will always include a WWW-Authenticate header that describes how to authenticate.
This is a response generally returned by your web server, not your web application.
It’s also something very temporary; the server is asking you to try again.
So, for authorization I use the 403 Forbidden response. It’s permanent, it’s tied to my application logic, and it’s a more concrete response than a 401.
Receiving a 403 response is the server telling you, “I’m sorry. I know who you are–I believe who you say you are–but you just don’t have permission to access this resource. Maybe if you ask the system administrator nicely, you’ll get permission. But please don’t bother me again until your predicament changes.”
In summary, a 401 Unauthorized response should be used for missing or bad authentication, and a 403 Forbidden response should be used afterwards, when the user is authenticated but isn’t authorized to perform the requested operation on the given resource.
Well that’s my view on it anyway
Tweets
- Confession: This past year, I forgot that I'm a geek. I love technology. I am obsessed with software. And now it's time to be myself again!
- @Jermolene I can just imagine you outside with your laptop in a cardboard box. That is so completely you. Awesome.
- What's the best device for writing code outdoors in the sunshine? It's a beautiful day outside and I'm stuck indoors:(
- RT @randompunter: 10 Check Amazon.co.uk for cheap touchpad. 20 GOTO 10
- @IJohnson_TNF typical example of a beautiful Ruby blog - http://t.co/6lHzwX2 show me a .NET blog like that!
- @IJohnson_TNF I think the ruby people are just more shiny
- Blogs about Ruby are always so much prettier than blogs about .NET.
- @Oura_In_Flames It's not all that amazing, and very short!
- @Oura_In_Flames you played the Sonic Generations demo yet? ;)
- @Oura_In_Flames cheers for the birthday wishes, I've been too busy at work to even think about it...
- Reading Programming in Scala, and loving it!
- Learning Scala this weekend... Quite exciting!
- @serialseb okay, on Thursday ;)
- @Oura_In_Flames lol thanks
- After two weeks of dev, finally deployed my OpenRasta app on IIS. Feeling so pleased with myself!
- Arrived at work for 8am. First time that's happened in years!
- Last one in the office - again. #deadlines
- Finishing the evening with a book in bed!
- @Oura_In_Flames Then I must have done something terribly bad as I just got drenched
- Dear Mother Nature, please check your wall calendar is on the correct page. It's June, not January. Yes, June. #wet




