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

feat: support static token and token provider at the same time #1685

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

oliverlaz
Copy link
Member

Overview

Until now, providing both, token and tokenProvider wasn't truly supported, and when this was the case, the client always used the static token.

This PR allows the client to connect faster and save one roundtrip to the customer's servers.

The logic is the following:

  • if only token is provided - use the token (existing behavior)
  • if only tokenProvider is provided - use the tokenProvider (existing behavior)
  • if both token and tokenProvider are provided - use the token initially. Once it expires, use the tokenProvider (new behavior).

The new behavior aligns with the logic that the other SDKs have, and it potentially reduces the time it takes to establish a WS connection to our systems.

In addition, we now validate internally that the token provided by the token provider is issued for the correct user_id. This should prevent potential integration issues.

This PR also refactors and cleans the code used to construct a new StreamVideoClient and also adds test cases for the critical parts of it.

Also, a few dependencies are updated to their latest versions (axios, sdp-transform, ua-parser-js, vitest, etc...).

@oliverlaz oliverlaz merged commit 4365a3d into main Feb 17, 2025
19 checks passed
@oliverlaz oliverlaz deleted the support-token-and-token-provider branch February 17, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants