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 committed Jun 1, 2023
1 parent d4f96e5 commit e04330d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,40 @@ 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
```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 e04330d

Please sign in to comment.