API:POST /login

From SoFurry
Revision as of 14:25, 15 May 2016 by Tetsudra (talk | contribs) (Request)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Resource URL

https://api.sofurrybeta.com/login

Request

POST /login
{
  "username": "bob",
  "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.