Authorization

Authorization

Authorization allows you to grant permission to access the requested data for an application program. Authorization token (here, Authorization-ot) will be provided to you, while you login for Output Time. The user must provide the authorization token (Authorization-ot) in the request header to prove that they has granted permission. Providing invalid token, your request will be treated as anonymous.

Validity

Authorization token (Authorization-ot) will valid only upto 30 days, after-then it will expire. You must have to get a valid Authorization-ot token, after its expiration.

Login

Request:

Use Post method, for “login” purpose.

POST  /api/v1/auth/authorize

Example :

curl -k -X POST -H "Content-Type: application/json" 'https://mycompany.outputtime.com/index.php/api/v1/auth/authorize' --data '{"user_name":"user@outputtime.com","password":"P@ssw0rd123"}'

Response:

Status : 200 OK
{
 "name":"user_name",
 "token":"auth token"
}

or

 Status : 401 Unauthorized
 {
   "error":"The email or password you entered is incorrect."
 }

Example :

{
"name":"user",
"token":"5b6485de53d6f473ab76ae1ffad5e63c3574f942==1"
}
here, Authorization-ot : 5b6485de53d6f473ab76ae1ffad5e63c3574f94==1, which the user have to provide in all request header for authorization.

Logout

Use Get method, for “logout” purpose. You have to provide Authorization-ot (auth token) in request header.

Request:

GET   /api/v1/auth/logout

Response:

Status: 200 OK
 {
 "success":true
 }

or

Status : 401 Unauthorized
 {
  "error":"Invalid API Token"
 }