Skip to content

Commit

Permalink
Add docs on use of cachePrefix
Browse files Browse the repository at this point in the history
based on findings in this issue: ringcentral#214
  • Loading branch information
Elridge D'Mello authored and embbnux committed Jun 15, 2023
1 parent 26bead8 commit b9097d4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,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

0 comments on commit b9097d4

Please sign in to comment.