Skip to content
Sam Codrington edited this page Nov 20, 2017 · 5 revisions

The auth/ route covers authorization and credentials by creating a session based on the user logging in. A login access returning a response with a cookie attached to it that must be sent with any subsequent requests requiring authorization.

As of right now the cookie value is sent back with the response to login in the field connect.sid and copying that key-value pair to any authorized requests will persist the session. connect.sid is required to be set in the headers of the request to logout as it contains all session data.

POST /login

      Login the user and create a persistent session, returning a cookie for subsequent requests needing authorization.

Headers

Content-Type application/x-www-form-urlencoded

Request Body

Parameter Type Required
username string yes
password string yes

Responses

Status Code Meaning
200 Login Successful. Currently response returns user object
401 Login unsuccessful, backend console log gives further information

IMPORTANT connect.sid Cookie is returned under res.req.headers.cookie


POST /logout

      Logout a user, removing user from passport.session.

Headers

Content-Type application/x-www-form-urlencoded
cookie connect.sid = (valid cookie returned from login)

Request Body

Parameter Type Required
username string Yes
password string Yes

Responses

Status Code Meaning
200 Logout Successful.
other Logout unsuccessful, user is not logged in

USERS

    PUSH /create

    GET /validate

Clone this wiki locally