Authentication
Passing Authentication
The Opentact API will require an API Key to authenticate requests.
All API requests are required to be made over HTTPS, HTTP requests will return back a 301 response - permanent redirection.
There are 5 methods to pass authentication to the API.
For accessing the API a valid email and password must be passed in the 'Authorization' header.
The following syntax must be used in the header 'Authorization: Basic base64(email:password)'
A valid token is base64 encoded value of 'email:password'
The following syntax must be used in the headers:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=v
Security Scheme Type
HTTP Authorization Scheme
HTTP
Basic
Methods
Auth
GET
https://api.opentact.org/rest/auth
This will authenticate the user.
{
"success": true,
"payload": {
"created_on": "2020-10-26T08:44:15.621Z",
"modified_on": "2020-10-26T08:44:16.023Z",
"uuid": "60e9fa76-20e7-45ee-bf24-8c4a95143dad",
"email": "abc@example.co.uk",
"phone_number": null,
"first_name": "John",
"last_name": "Smith",
"dob": null,
"gmail_user_id": "107653031006300523703",
"facebook_user_id": null,
"apple_user_id": null,
"wechat_user_id": null,
"role": "User",
"gender": null,
"deleted_on": null,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNjBlOWZhNzYtMjBlNy00NWVlLWJmMjQtOGM0YTk1MTQzZGFkIiwiaWF0IjoxNjAzNzI2MzM4LCJleHAiOjE2MDM4MTI3Mzh9.uiBWYvx2Bb0zQjellXi4Y2C_DdEhhU6c6R6q979HBus"
}
}
Code Examples
curl -X GET "https://api.stage.opentact.org/rest/auth" \
-H "accept: application/json" -H "X-Auth-Token: JWT_TOKEN"
Token
POST
https://api.opentact.org/rest/token
This will create a new bearer token.
Request Body
name
string
Name
ttl
integer
Time to live (min 60)
{
"success": true,
"payload": {
"name": "string",
"ttl": 60,
"token": "7VLyaDSQ8W48IETeNBfxbBqwgwzWLTvFojSnLgiXP5X8NSoE",
"expired_on": "2020-10-26T15:58:28.701Z",
"uuid": "bac27d93-df33-4e47-b4a1-edfcae0d3654",
"created_on": "2020-10-26T15:57:28.706Z",
"modified_on": "2020-10-26T15:57:28.706Z"
}
}
Code Examples
curl -X POST "https://api.opentact.org/rest/token" \
-H "accept: application/json" -H "X-Auth-Token: JWT_TOKEN" \
-H "Content-Type: application/json" -d "{\"name\":\"string\",\"ttl\":60}"
Tokens
GET
https://api.opentact.org/rest/token/list
This will return a list of tokens.
{
"success": true,
"payload": []
}
Code Examples
curl -X GET "https://api.opentact.org/rest/token/list" \
-H "accept: application/json" -H "X-Auth-Token: JWT_TOKEN"
Token
PATCH
https://api.opentact.org/token/{uuid}
TBD
Path Parameters
uuid
string
Code Examples
Tokens
DELETE
https://api.opentact.org/rest/token/all
This will delete all tokens
{
"success": true,
"payload": {}
}
Code Examples
curl -X DELETE "https://api.opentact.org/rest/token/all" \
-H "accept: application/json" -H "X-Auth-Token: JWT_TOKEN"
Token
DELETE
https://api.opentact.org/rest/token/{token}
This will delete a specific token
Path Parameters
string
{
"success": true,
"payload": {
"created_on": "2020-10-26T16:41:12.952Z",
"modified_on": "2020-10-26T16:41:12.952Z",
"token": "OVt9di1JqNEmrp2KbLPQ7yHuHb9EZ4yaw4pMS6pyWjuUeT7P",
"name": "string",
"expired_on": "2020-10-26T16:42:12.951Z"
}
}
Code Examples
curl -X DELETE "https://api.opentact.org/rest/token/{JWT_TOKEN}" \
-H "accept: application/json" -H "X-Auth-Token: JWT_TOKEN"
Last updated
Was this helpful?