Skip to content

Authentication

Kyle (Qiankang) Zhou edited this page Nov 6, 2017 · 13 revisions

Authentication

Sign In

URL

/api/auth

Method

POST

URL Params

None

Header

None

Request Body

Key Type Required Description
email String Yes Account Email
password String Yes Account Password
Example
{
    "email": "[email protected]",
    "password": "foobar"
}

Response On Success

Code

200 OK

Content Example
{
    "token": "foo123bar.foobar123.123foobar",
    "user": {
         "email": "[email protected]",
         "id": "123456789",
         "wishlist": [
              {
       	           "id": "123",
                   "start_date": "2013-05-14T00:01:00.234Z",
                   "city": "Madison",
                   "duration": "6 month",
                   "price": "1234.5",
                   "title": "Sample Title",
                   "photo_link": "http://link-to-photo"
              },
              {
                   "id": "124",
                   "start_date": "2013-05-14T00:01:00.234Z",
                   "city": "Madison",
                   "duration": "1 year",
                   "price": "1234.5",
                   "title": "Sample Title 2",
                   "photo_link": "http://link-to-photo"
              }   
         ]
    }
}

Response On Error

Code

400 Bad Request

Content Example
{
    "message": "Malformed Request"
}
Code

401 Unauthorized

Content Example
{
    "message": "Invalid Email/Password Combo"
}
Code

403 Forbidden

Content Example
{
    "message": "Inactive account"
}
Code

500 Internal Server Error

Content Example
{
    "message": "Internal Server Error"
}

Sign Out

URL

/api/auth

Method

DELETE

URL Params

None

Header

Key Required Description
token Yes Authorization Token

Request Body

None

Response On Success

Code

204 No Content

Response On Error

Code

204 No Content

Get Employee Auth Token For Testing

URL

/api/auth

Method

GET

URL Params

None

Header

None

Request Body

None

Response On Success

Code

200 OK

Content Example
{
    "message": "This is an employee auth token for testing only.",
    "token": "foo123bar.foobar123.123foobar"
}

Response On Error

Code

500 Internal Server Error

Content Example
{
    "message": "Internal Server Error"
}