iosauthentication

Which HTTP response code should I give my application to say that authentication was successful?


I have an API which validates a user and I don't know what to return to my iOS application when authentication is and isn't successful. I'm currently returning a 401 error for failed authentication, but how should I tell my iOS application that authentication was successful?


Solution

  • You could use an HTTP 200, which indicates the request was OK without problems. You could also potentially use 201 to indicate a new session has been created.

    For explanations on HTTP status codes, please see Wikipedia's list of HTTP status codes