Skip to content

Comments

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

Merged
oliverlaz merged 3 commits intomainfrom
support-token-and-token-provider
Feb 17, 2025
Merged

feat: support static token and token provider at the same time#1685
oliverlaz merged 3 commits intomainfrom
support-token-and-token-provider

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