The base URL for authentication is http://test.authentication.acumen.me

Firstly you authenticate using the credentials and get the bearer token that will be passed with every request to the resources APIs.

This bearer token are valid for 30 minutes. The response body from the authentication contains a refresh token that will be used to generate another valid token in case the current token is expired.

How to authenticate using credentials?

Send a post request to the following endpoint: /api/auth/login with the content type of application/json and the body looks like:

{
  "UserName": "YOUR_USERNAME",
  "Password": "YOUR_PASSWORD",
  "GrantType": "password"
}

with replacing the values of YOUR_USERNAME and YOUR_PASSWORD How to authenticate using refresh token?

It’s the same as authenticating with credentials expect the body looks like:

All has the same following properties expect the body.

{
  "GrantType": "refresh_token",
  "RefreshToken":"YOUR_REFRESH_TOKEN"
}

with replacing the value of YOUR_REFRESH_TOKEN.

The response of authentication endpoints

The two endpoints (credentials and refresh token) will respond with the following content:

{
    "token": "GENERATED_JWT_TOKEN",
    "user_id": "USER_ID",
    "username": "USERNAME",
    "refresh_token": "REFRESH_TOKEN",
    "current_customer": {
        "name": "CUSTOMER_NAME",
        "customer_id": CUSTOMER_ID
    },
    "customers": [
        {
            "name": "CUSTOMER_NAME",
            "customer_id": CUSTOMER_ID
        }
    ],
    "services": [
        {
            "service_id": 39,
            "name": "Print News"
        },
        {
            "service_id": 40,
            "name": "Internet News"
        }
    ],
    "rules": [
        {
            "rule_id": 1,
            "name": "RULE_NAME_1"
        },
        {
            "rule_id": 2,
            "name": "RULE_NAME_2"
        }
    ]
}

token holds the bearer token that will be sent to every resource API. user_id GUID for the current user. username is the username of the authenticated user. refresh_token holds the token that will be used to regenerate the new token in case of the expiration of the bearer token. current_customer represents the meta data for the current customer. customers an array of the customers related to the user. services an array of the services assigned to the user. rules an array of the rules related to the user.