Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs on use of cachePrefix #215

Merged
merged 1 commit into from
Jun 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,41 @@ rcsdk
});
```

### Multi User Login

If you need to have multiple users login in to different instances of the sdk, you can use the `cachePrefix` SDK option. Specify different `cachePrefix` values for each instance.

```js
const rcsdk1 = new RingCentral.SDK({
server: RingCentral.SDK.server.sandbox,
clientId: 'yourClientId',
clientSecret: 'yourClientSecret',
cachePrefix: 'user1',
});

rcsdk1.login({
username: '18001234567',
extension: '101',
password: 'password1'
})

const rcsdk2 = new RingCentral.SDK({
server: RingCentral.SDK.server.sandbox,
clientId: 'yourClientId',
clientSecret: 'yourClientSecret',
cachePrefix: 'user2',
});

rcsdk1.login({
username: '18005557777',
extension: '102',
password: 'password2'
})

```
This prevents login state from being shared between the two instances `rcsdk1` and `rcsdk2`


## Handling login success

Because the login process is asynchronous, you need to call the promise's `then` method and pass your success handler as
Expand Down