API:POST /login

From SoFurry
Revision as of 12:42, 25 April 2016 by Tetsudra (talk | contribs)
Jump to: navigation, search

Resource URL

https://api.sofurrybeta.com/login

Request

POST /login
{
  "email": "bob@example.org",
  "password": "hunter2"
}

Response: Success

HTTP 200
{
  "result": true,
  "token": "1:fd776c3a631eeae849688a618887546d"
}

If the result is TRUE, then the login was a success. The token it returns should be sent on all future requests, using the X-SoFurry-Token HTTP header.

Response: Failed Login

HTTP 422
{
  "result": false,
  "message": "Incorrect username or password"
}

You don't need to display that exact message in your client app. It will fail like this if the email address or password is incorrect, or if the user has not yet been activated.