# smartone-js

> SmartONE SDK in Javascript

Latest version **0.0.2** (published 2023-06-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install smartone-js
pnpm add smartone-js
yarn add smartone-js
bun add smartone-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-06-03 |
| First published | 2023-06-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ali Yousuf |
| Maintainers | alyyousuf7 |

## Links

- npm: https://www.npmjs.com/package/smartone-js
- Repository: https://github.com/alyyousuf7/smartone-js
- Issues: https://github.com/alyyousuf7/smartone-js/issues
- npm.io page: https://npm.io/package/smartone-js

## Dependencies (6)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [jsdom](https://npm.io/package/jsdom.md) ^20.0.0
- [jwt-decode](https://npm.io/package/jwt-decode.md) ^3.1.2
- [tough-cookie](https://npm.io/package/tough-cookie.md) ^4.1.2
- [openid-client](https://npm.io/package/openid-client.md) ^5.4.2
- [axios-cookiejar-support](https://npm.io/package/axios-cookiejar-support.md) ^4.0.3

## Recent versions

- 0.0.2 (latest) — 2023-06-03
- 0.0.1 — 2023-06-03

## README

# SmartONE JS SDK

## Installation
```bash
npm i smartone-js
```

## Usage

### Creating SmartONE instance
Create instance for the first time with login credentials:
```js
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:
```js
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;
```

---
_Source: https://npm.io/package/smartone-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
