Token#
Methods#
POST#
Accepts form data or JSON to authenticate a user’s credentials, returning a bearer token if successful.
POST /token
The payload, whether form data or JSON, should have the following attributes:
Attribute |
Value Type |
Description |
---|---|---|
|
string |
The username of the user. |
|
string |
The user’s password. |
If the credentials are valid, the response will have a 200 status code and the payload will be a JSON object with the following attributes:
Attribute |
Value Type |
Description |
---|---|---|
|
string |
The access token to use in subsequent requests to authorise them. |
|
integer |
The length of time in seconds before the token expires. Normally |
|
string |
Type of the token. Normally |
To use the token in a request, set the Authorization
header value to Bearer {your access token}
, where {your access token}
should be replaced with the value of access_token
in the response.
The response will be a 401 error if the user cannot be authenticated because the username or password are incorrect.
The response will be a 400 error if either attribute is missing or a value is of an invalid type.