Skip to content

Commit 8a1d85f

Browse files
Merge pull request #213554 from petrsvihlik/patch-6
Sign-out best practices
2 parents c20b3b5 + e302639 commit 8a1d85f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

articles/communication-services/concepts/credentials-best-practices.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,11 @@ leaveChatBtn.addEventListener('click', function() {
282282
});
283283
```
284284
285+
If you want to cancel subsequent refresh tasks, [dispose](#clean-up-resources) of the Credential object.
286+
285287
### Clean up resources
286288
287-
Since the Credential object can be passed to multiple Chat or Calling client instances, the SDK will make no assumptions about its lifetime and leaves the responsibility of its disposal to the developer. It's up to the Communication Services applications to dispose the Credential instance when it's no longer needed. Disposing the credential is also the recommended way of canceling scheduled refresh actions when the proactive refreshing is enabled.
289+
Since the Credential object can be passed to multiple Chat or Calling client instances, the SDK will make no assumptions about its lifetime and leaves the responsibility of its disposal to the developer. It's up to the Communication Services applications to dispose the Credential instance when it's no longer needed. Disposing the credential will also cancel scheduled refresh actions when the proactive refreshing is enabled.
288290
289291
Call the `.dispose()` function.
290292
@@ -296,6 +298,13 @@ const chatClient = new ChatClient("<endpoint-url>", tokenCredential);
296298
tokenCredential.dispose()
297299
```
298300
301+
## Handle a sign-out
302+
303+
Depending on your scenario, you may want to sign a user out from one or more services:
304+
305+
- To sign a user out from a single service, [dispose](#clean-up-resources) of the Credential object.
306+
- To sign a user out from multiple services, implement a signaling mechanism to notify all services to [dispose](#clean-up-resources) of the Credential object, and additionally, [revoke all access tokens](../quickstarts/access-tokens.md?tabs=windows&pivots=programming-language-javascript#revoke-access-tokens) for a given identity.
307+
299308
---
300309
301310
## Next steps

0 commit comments

Comments
 (0)