ds-wrapper for the Digitalstrom Server
A simple wrapper based on promises.
Manages authentication and session tokens
The module can manage the task of retrieving and authenticating the application token, aswell as retrieving and refreshing the session token.
Usage
Import the module
/* specify dss ip and loglevel as parameter */const ds = '192.168.188.4' 0;
Retrieving the application token
There is a fully automated process available, that enables the token by logging in the User.
The Application Token must be stored, because it does not expire, once authenticated!
/* Authentication */let app_token;ds;
The option to authenticate the token in the user interface is also available, although not recommended.
;
Sending requests
To request an action that has to be authenticated by a session token (refer to the docs...) another function can be used.
/* Performing actions */const path = '/json/apartment/getName'; ds;
Functions
requestWithSessionFromDSS
Performs a request to the dss with automatic session management.
/** * Requests from dss with session token * @param * @param * @param * @returns */
retrieveApplicationToken
/** * Retrieves AppToken from dss. * @param * @returns */
activateApplicationToken
/** * Activates application token with credentials * @param * @param * @param * @returns */
initializeAuthentication
/** * Automatic authentication of application in the dss * @param * @param * @param * @returns */