npm.io
0.0.2 • Published 3 years ago

smartone-js

Licence
ISC
Version
0.0.2
Deps
6
Size
18 kB
Vulns
24
Weekly
0

SmartONE JS SDK

Installation

npm i smartone-js

Usage

Creating SmartONE instance

Create instance for the first time with login credentials:

import { SmartONE } from 'smartone-js';

const one = await SmartONE.withCredentials('[your-username]', '[your-password]');
const token = one.getToken();
const refreshToken = token.refresh_token;

You can reuse the token to create the instance again:

import { SmartONE } from 'smartone-js';

const refreshToken = ...; // your logic to load refresh token
const one = await SmartONE.withRefreshToken(refreshToken);

// Or refresh the token:
const newToken = await one.refreshToken();
const newRefreshToken = newToken.refresh_token;