alyyousuf7 / smartone-js

Javascript client for SmartONE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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;

About

Javascript client for SmartONE


Languages

Language:TypeScript 100.0%