stream-chat-swift icon indicating copy to clipboard operation
stream-chat-swift copied to clipboard

`TokenProvider` invoked multiple times, simultaneously

Open bradleyrzeller opened this issue 3 years ago • 1 comments

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.

bradleyrzeller avatar Aug 29 '22 18:08 bradleyrzeller

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!

polqf avatar Aug 29 '22 18:08 polqf

Hi!

The issue has been fixed in the 4.23.0 release! 🚀

Best, Nuno

nuno-vieira avatar Oct 27 '22 17:10 nuno-vieira