npm i smartone-js
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;