Skip to content

Authorization

This endpoint is used to obtain an authentication token from the server, as well as to set an expiration date and time for the token.

Get Access Token

Description:

This request will result in a token generated by the server if successful. The token is a long random string, and must be provided for all following calls as a header element named x-connectfi-token.

Request method and URL:

POST /auth/get-token

Request headers:

{
    "Content-Type": "application/json"
}

Request body example:

{
    "user" :{
        "login": "demo",
        "password": "demo"
    }
}

Response examples:

200 (HTTP response status code) -- Token is successfully created

{
    "code": "0", //Code "0" means that the request was successful
    "data": {
        "token": "a long random string" //Token to be used for all subsequent calls 
        "dtsExpireAt": "2022-10-07T08:18:57.360Z" //Token expiration date
    }
}

401 (HTTP response status code) -- Unauthorized

{
    "code": "unauthorized",
    "message": "Authentication error"
}

Using Authorization Token

In all subsequent requests, the token will need to be added into the request headers as a key:value pair with the key name "x-connectfi-token":

"x-connectfi-token": "a long random string"

curl --location --request GET 'http://sample.com/sampleurl' \
--header 'x-connectfi-token: 2dImU5MSc4QCC5y3JJYp7A6cgZ2aNH6nyThjadS7k2kC42262YTedrOPMD9JglnsaR' \
--data-raw ''