Authentication

Edit on GitHub

The authentication and authorization of operations via the Azion API, through Tokens.

The first step is to create the Token by authenticating a user in Real-Time Manager.

  1. How to code the User and Password in Base64
  2. Token Creation
  3. Revoking a Token

1. How to code the User and Password in Base64

Only the creation and revocation operations are done using Basic Authentication, i.e. with the user and password. You can create and revoke the token through the API itself, but to do this you first need to code the user and password in base64.

The base64 coding can be done in the command line of a Unix terminal:

$ echo 'user@domain:password'|base64
 dXNlckBkb21haW46cGFzc3dvcmQK

f you don’t have a Unix terminal available, you can use the free online service at https://www.base64encode.org/.


2. Token Creation

POST /tokens

Parameter Description Type of Parameter Type of Data
Authorization (mandatory) The basic authentication in order to create a Token is done through the pair “user@domain:password” coded in base64 and sent by an HTTP request with the header “Authorization: Basic ”.

For example, if the user was “user@domain” and the password was “password” the resulting base64 coding for the string “user@domain:password” would be “dXNlckBkb21haW46cGFzc3dvcmQK” and the header that would be sent would be:

e.g.:

Authorization:
Basic
dXNlckBkb21haW46cGFzc3dvcmQK
header string

Example Request

POST /tokens
Accept: application/json; version=1
Authorization: Basic dXNlckBkb21haW46cGFzc3dvcmQK

Example Response

HTTP/1.1 201 CREATED
{  
   "token":"583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf",
   "created_at":"2016-11-18T14:10:58.024903Z",
   "expires_at":"2016-11-19T14:10:58.024903Z"
}

3. Revoking a Token

DELETE /tokens/:token

Parameter Description Type of Parameter Type of Data
Authorization (mandatory) The basic authentication in order to create a Token is done through the pair “user@domain:password” coded in base64 and sent by an HTTP request with the header “Authorization: Basic ”.

For example, if the user was “user@domain” and the password was “password” the resulting base64 coding for the string “user@domain:password” would be “dXNlckBkb21haW46cGFzc3dvcmQK” and the header that would be sent would be:

e.g.:

Authorization:
Basic
dXNlckBkb21haW46cGFzc3dvcmQK
header string
:token (mandatory) Token that you want to delete path string

Example Request

DELETE /tokens/583f8a9ca8d6d5ff2cb50f1d3c4d35cb8939f1bf
Accept: application/json; version=1
Authorization: Basic dXNlckBkb21haW46cGFzc3dvcmQK

Example Response

HTTP/1.1 204 NO CONTENT

Didn’t find what you were looking for? Open a ticket.