Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1021 Bytes

File metadata and controls

34 lines (25 loc) · 1021 Bytes

Auto Refrsh Extension

This extension will auto refresh your token every 30 minutes(customizable).

Install

yarn add @rc-ex/auto-refresh

Usage

import RingCentral from '@rc-ex/core';
import AutoRefreshExtension from '@rc-ex/auto-refresh';

const rc = new RingCentral(...);
const autoRefreshExtension = new AutoRefreshExtension();
await rc.installExtension(autoRefreshExtension);
autoRefreshExtension.start();
// autoRefreshExtension.stop();

For a working sample, please check this test case.

Disclaimer

Token management is a complicated topic. There is no one-fit-all solution. This extension is an quick-and-dirty out-of-box solution to refresh your token. It is by no means the best practice. It simply starts a background timers to refresh your token periodically. For serious production applications, you may need better token management strategy.