Create Token
This API is used to create a token in the security management application.
| HTTP URL | |
|---|---|
| POST | /api/v2/auth/token |
Eligibility
The Requester can make a request for an access token for the user name and password that the Requester provided.
API Request
Request Structure
| Parameter | Type | M/O/CM | Description |
|---|---|---|---|
| username | String | M | Security Management Application username |
| password | String | M | Security Management Application password |
API Response
Response Structure
| Parameter | Type | M/O/CM | Description |
|---|---|---|---|
| errorCode | String | O | Failure code. |
| errorMessage | String | O | Failure message. |
| content | Object | O | Array of main response body object displayed when an API call was successful. For a failure, it will be empty. |
| pageable | Object | O | Paging information object displayed when an API call was successful. For a failure, it will be empty. |
Content data objects
| Element | Type | M/O/CM | Description |
|---|---|---|---|
| customerId | UUID | M | Universally unique customer identifier |
| token | String | M | Access token created by the security management application |
| refreshToken | String | M | Token created by the security management application for token session extension purposes |
| validityTime | Numeric | M | Token validity time in seconds |
Pageable data objects
| Element | Type | M/O/CM | Description |
|---|---|---|---|
| page | Numeric | M | Page number |
| size | Numeric | M | Page size. Number of requested elements per page |
| totalPages | Numeric | M | Total amount of available pages per requested page size |
| totalElements | Numeric | M | Total amount of retrieved elements |
Error Codes
In addition to the general success and failure codes, the following error codes are possible.
| Code | Message |
|---|---|
| AUTH_1001 | Invalid credentials |
Examples
Request Body
Copy
{
"username": "ethan.buckley@datastoreltd.biz",
"password": "S0qUx56pW!"
}
Response Body: Success ACK:
Copy
{
"errorCode": "",
"errorMessage": "",
"content": [
{
"customerId": "e7fcef24-5c03-41dd-9e33-995b7d6f47a7",
"token":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjE1NSwiZW1haWwiOiJzaGF1bC5jb2hlbkBmb...",
"refreshToken":
"eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI4NzlmN2I0Yy1hZjU3LTQ4Y2ItYTc2Mi1kY2Ew...",
"validityTime": 3600
}
],
"pageable": {
"page": 0,
"size": 10,
"totalPages": 1,
"totalElements": 1
}
}
Response Body: Failure NAK:
Copy
{
"errorCode": "AUTH_1001",
"errorMessageerrorMessage": "Invalid credentials",
"content": "",
"pageable": ""
}