Authorization to NFleet APIs
Authorization to NFleet APIs is performed by requesting an OAuth 2.0 access token from NFleet Identity service for an identity assigned to a client. Refer to the Assigning a client identity section in NFleet Portal user guide.
Requesting an access token for an identity is performed by making a POST request to NFleet identity service token endpoint.
| Method | URI | HTTP version |
|---|---|---|
POST |
https://id.nfleet.fi/<identity_guid>/token |
HTTP/1.1 |
URI parameters
| Parameter | Description |
|---|---|
identity-guid |
The GUID referring to the identity the client is performing the request for. For a client application, this is the assigned identity of the application. For a user account, this GUID refers to the id of the assignment of a user to a the client making the request. |
Request headers
| Header | Description |
|---|---|
Authorization |
Required. Basic auth credentials as Base64 encoded octet sequence of UTF-8 characters which contains the client key and the client secret for the client requesting the access token, separated by the : character. The header format is Basic <credentials> |
Response codes
HTTP 200 OK. Indicates that the request succeeded and that the response contains an OAuth 2.0 access token for the identity requested.
HTTP 401 Unauthorized. Indicates that the request did not have the correct credentials for the identity requested. Make sure that the identity-guid refers to an id for an assignment of a user to the client application with the credentials used in the request.
Example response
The elements of the response body are as follows.
| Field | Type | Description |
|---|---|---|
access_token |
string | The OAuth 2.0 access token for the identity requested with parameter identity-guid. |
token_type |
string | The type of the access token. |
expires_in |
number | Number of seconds the access token is valid. |
The value of the field access_token is used as in the Authorization header to authenticate the requests to the service. The header format is Authorization: Bearer ey…y76A.