What HTTP status code for unactivated account?

Johnathan Au picture Johnathan Au · Mar 25, 2013 · Viewed 9.1k times · Source

Which HTTP status code should I respond with after authenticating the user and then finding out that they have not activated their account after registration?

Answer

BalusC picture BalusC · Mar 25, 2013

401 means that the user is unknown (not authenticated at all or authenticated incorrectly, e.g. the credentials are invalid).
403 means that the user is known but not authorized (i.e. doesn't have the proper role/group).

You could also interpret a registered but inactivated account as an user having a specific role like "INACTIVE" and/or lacking the proper role. 403 is more appropriate in your particular case.