Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

Auth Endpoint API Reference

Patrick Tone edited this page Apr 4, 2017 · 3 revisions

Auth

Method Endpoint Verb Description
Login /auth POST Start a session with a valid email/password and returns a token
Logout /auth DELETE Given a token, destroy the given token
Create /auth/create POST Create a auth_user with a email/password
Role /auth GET Given a token, returns the associated user role

More Info

Login

Start a session by passing a valid email/password and returns a token.

  • Endpoint: /auth

  • Verb: POST

  • Request:

    {
      "email" : STRING,
      "password": STRING
    }
  • Response:

    STATUS 201 - Success

    { 
      "token": STRING
    }

    STATUS 401 - Error

    { 
      "message": STRING
    }

Logout

Given a token, destroy the given token.

  • Endpoint: /auth

  • Verb: DELETE

  • Request:

  • Response:

    STATUS 201 - Success

    STATUS 401 - Error

    { 
      "message": STRING
    }

Create

Create a auth_user with a email/password and role.

  • Endpoint: /auth/create

  • Verb: POST

  • Request:

    {
      "email" : STRING,
      "password": STRING,
      "role": ENUM [STUDENT, COORDINATOR]
    }
  • Response:

    STATUS 201 - Success

    STATUS 401 - Error

    { 
      "message": STRING
    }

Role

Given a token, returns the associated user role.

  • Endpoint: /auth

  • Verb: GET

  • Request:

    {
      "token" : STRING
    }
  • Response:

    STATUS 201 - Success

    { 
      "role": ENUM [STUDENT, COORDINATOR]
    }

    STATUS 401 - Error

    { 
      "message": STRING
    }

test sidebar

Clone this wiki locally