RevealBi / Reveal.Sdk

Issue tracker - Reveal SDK https://www.revealbi.io/
https://www.revealbi.io/
3 stars 0 forks source link

async version of setAdditionalHeadersProvider #185

Open StevybSC opened 7 months ago

StevybSC commented 7 months ago

Is your feature request related to a problem? Please describe. When having to perform tasks such as check and renew a token client side to use in the headers, it is not possible to await async methods as the setAdditionalHeadersProvider is itself not async.

At the moment we have issues where if a use leaves a visualisation open and half built, and then returns after their auth token has expired, an error is thrown as we cannot capture the event and refresh the token.

Describe the solution you'd like Ability to await while a task is completed (e.g. check and renew if needed a JWT) on further calls to the datasource not just load.

Describe alternatives you've considered A timer that triggers in the background to refresh the token and reading the token from local storage on every header sent.

Additional context Please see the Discord thread. Also, to be clear, I'm requesting this for React.

RWenger-credlens commented 2 months ago

This would be very helpful for us as well - we're also running into this with auth. The alternative with timeouts doesn't work very well for us.