Skip to content

Commit

Permalink
Merge pull request #215 from ElridgeDMello/docs-multi-user-login
Browse files Browse the repository at this point in the history
Add docs on use of cachePrefix
  • Loading branch information
tylerlong authored Jun 1, 2023
2 parents dcb63a6 + 69437a3 commit 9756bbb
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 9756bbb

Please sign in to comment.