`TokenProvider` invoked multiple times, simultaneously
What did you do?
Initialized ChatClient with a token provider that initially provides an expired token (a typical scenario if attempting to cache tokens from prior sessions).
What did you expect to happen?
I expected the TokenProvider to be re-invoked once.
What happened instead?
The TokenProvider was invoked twice.
GetStream Environment
GetStream Chat version: 4.20.0 GetStream Chat frameworks: StreamChat, StreamChatUI iOS version: 15.5 Swift version: 5 Xcode version: 13.4.1 Device: iPhone 13 Pro Sim
Additional context
It seems that both the web socket AND the api client are encountering auth errors with the initial token and are triggering a refresh independently of each other. We can guard against this scenario in our app code but ideally getstream can better coordinate refresh attempts so that this extra logic is not needed.
Hi @bradleyrzeller,
You are right about this, there can be a scenario where this happens. This issue is already in our backlog but was not prioritized just yet.
We'll keep you posted on this!
Hi!
The issue has been fixed in the 4.23.0 release! 🚀
Best, Nuno