0.0.2 • Published 11 months ago

smartone-js v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

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;