Request Headers (Applies to all methods)
POST
/api/apps/{appID}/oauth2/token
Request a new token.
The following four types of requests are available. The request type is to be set as the "grant_type" parameter:
- authorization_code: Request a new token with an OAuth2 authorization code. You need to fill in the parameters "client_id, "client_secret", "code", and "redirect_uri".
- client_credentials: Request a new app admin or anonymous token. You need to fill in the parameters "client_id" and "client_secret". Note that the values you need to put in these parameters depend on the type of the token you want to get.
- password: Request a new user/thing token with the user/thing credentials. You need to fill in the parameters "username" and "password".
- refresh_token: Request a new access token by providing the current refresh token. You need to fill in the the parameter "refresh_token".
As users and things are entities that can be authenticated by Kii Cloud, they are considered also as the principals when referring the authentication contexts. The principalID in these cases will be the userID and thingID.
Content-Type application/x-www-form-urlencoded
All the required information to request a token. We advise to use prefixed addresses.
The type of the request.
- authorization_code
- client_credentials
- password
- refresh_token
The client_id for the OAuth2 authorization flow
- The Kii application's clientID for getting an app admin token.
- The Kii application's appID for getting an anonymous token.
The client_secret for the OAuth2 authorization flow
- The Kii application's clientSecret for getting an app admin token.
- The Kii application's appKey for getting an anonymous token.
Provide one of the following for getting a user token:
- The login name of the user
- The email address of the user
- The email address of the user with prefix: EMAIL:{emailAddress}
- The phone number of the user in international format: +XXX...
- The phone number of the user in local format: PHONE:{countryCode}-{localPhone}
The country code is in ISO-3166 format. The phone number and email address must be verified.
For getting a thing token, the vendorThingID with the prefix: VENDOR_THING_ID:{vendorThingID} must be provided{
"grant_type": "[string]",
"client_id": "[string]",
"client_secret": "[string]",
"code": "[string]",
"redirect_uri": "[string]",
"username": "[string]",
"password": "[string]",
"refresh_token": "[string]"
}
Content-Type application/json
Name | Type | Description |
---|---|---|
id | string | The ID of the principal (user or thing). |
access_token | string | The access token issued by the authorization server. |
expires_in | long | The lifetime of the access token (in seconds). |
token_type | string | The token type. Only "Bearer" is supported. |
refresh_token | string | The new refresh token. |
Content-Type application/json
Name | Type | Description |
---|---|---|
errorCode | string | Oauth2 error code: "invalid_grant" or "unsupported_grant_type". |
error_description | string | The error description. |
error | string | Oauth2 error code |
POST
/api/apps/{appID}/oauth2/token
Request a new token.
The following four types of requests are available. The request type is to be set as the "grant_type" parameter:
- authorization_code: Request a new token with an OAuth2 authorization code. You need to fill in the parameters "client_id, "client_secret", "code", and "redirect_uri".
- client_credentials: Request a new app admin or anonymous token. You need to fill in the parameters "client_id" and "client_secret". Note that the values you need to put in these parameters depend on the type of the token you want to get.
- password: Request a new user/thing token with the user/thing credentials. You need to fill in the parameters "username" and "password".
- refresh_token: Request a new access token by providing the current refresh token. You need to fill in the the parameter "refresh_token".
The parameter "expiresAt" is optional for all the cases.
As user and things are entities that can be authenticated by Kii Cloud they are considered also as principals when referring authentication contexts, the principalID would be in those cases the userID or thingID.
Content-Type application/vnd.kii.OauthTokenRequest+json
All the required information to request a token. We advise to use prefixed addresses. application/json can be used as content-type for the compatibility.
The type of the request
- authorization_code
- client_credentials
- password
- refresh_token
The client_id for the OAuth2 authorization flow
- The Kii application's clientID for getting an app admin token
- The Kii application's appID for getting an anonymous token
The client_secret for the OAuth2 authorization flow
- The Kii application's clientSecret for getting an app admin token
- The Kii application's appKey for getting an anonymous token
- The login name of the user
- The email address of the user
- The email address of the user with prefix: EMAIL:{emailAddress}
- The phone number of the user in international format: +XXX...
- The phone number of the user in local format: PHONE:{countryCode}-{localPhone}
The country code is in ISO-3166 format. The phone number and email address must be verified.
For getting a thing token, the vendorThingID with the prefix: VENDOR_THING_ID:{vendorThingID} must be provided{
"grant_type": "[string]",
"code": "[string]",
"redirect_uri": "[string]",
"client_id": "[string]",
"client_secret": "[string]",
"username": "[string]",
"password": "[string]",
"expiresAt": "[long]",
"refresh_token": "[string]"
}
Content-Type application/json
Name | Type | Description |
---|---|---|
id | string | The ID of the principal (user or thing). |
access_token | string | The access token issued by the authorization server. |
expires_in | long | The lifetime of the access token (in seconds). |
token_type | string | The token type. Only "Bearer" is supported. |
refresh_token | string | The new refresh token. |
Content-Type application/json
Name | Type | Description |
---|---|---|
errorCode | string | Oauth2 error code: "invalid_grant" or "unsupported_grant_type". |
error_description | string | The error description. |
error | string | Oauth2 error code |