![Daikin Airzone Скачать руководство пользователя страница 6](http://html1.mh-extra.com/html/daikin/airzone/airzone_api-integration-manual_502360006.webp)
API Integration Manual for Daikin DKN Cloud Wi-Fi Adaptor
5
From now on, the application is authorized to make requests to the API in behalf of the user,
provided the request presents the access token for authentication. If the access token is valid, the
resource server (API) serves the resource to the application.
2.2.1 Refresh Token
The authorization response contains a pair of tokens: an access token and a refresh token. The
access token is the token used in every request made to the API to authenticate the request in
behalf of the user. The refresh token on the other hand is used for requesting a new access token
when this one expires.
Once the application has an access token, it may use the token to access the user's account via the
API, limited to the scope of access, until the token expires or is revoked. After an access token
expires, using it to make a request from the API will result in an "Invalid Token Error" (401 status).
At this point, the refresh token can be used to request a fresh access token from the authorization
server.
Now that the Oauth2 foundations have been explained, we will describe in detail the different
requests and responses handled by the Open API. The following must be used as an
implementation reference by the third party services for a successful integration with the DKN Cloud
NA’s Open API.
2.3 Open API OAuth2 Implementation
As prerequisites, users must have a valid account in both environments (third party application and
DKN Cloud NA), the third party application must be registered as an authorized entity by DKN
Cloud NA (meaning that the third party will have a valid client_id/client_secret token pair), and for
third party applications with web interface, a valid Redirect URI.
Since the authentication flow involves the linking of accounts between services, the user must first
log in to DKN Cloud NA and authorize the third party service to access his information. This can be
done in two ways: through the DKN Cloud NA website (for third party services with their own
websites/applications) or through the programmatic interface (recommended for integration and
automation systems).
All requests must be done using HTTPS protocol, and will throw an error if trying to use plain HTTP.
Note:
the following HTTP request examples will be done using the
2.3.1 Web Interface
Step 1.
If the third party application wants to make the authorization through a web interface based
flow, the application must redirect the user to the following authorization URL:
https://dkncloudna.com/#/oauth?response_type=code&client_id=CLIENT_ID&redirect_uri=CALLBA
CK_URL&scope=instaldevices&state=STATE_TOKEN
Here is an explanation of the link components. The parameters are set in
querystring
format:
https://dkncloudna.com/#/oauth
the API authorization endpoint.
client_id=CLIENT_ID
: the application's client ID (how the API identifies the application).