cube-js/cube

How can I perceive the token-expired situation?

Open

#3862 aperta il 29 dic 2021

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Rust (1965 fork)batch import
help wanted

Metriche repository

Star
 (19.563 star)
Metriche merge PR
 (Merge medio 5g 16h) (138 PR mergiate in 30 g)

Descrizione

If the token is expired, I will get an error with HTML message filled: <span data-ansi-line="true"><span>Not authorized</span></span>. I use WebSocketTransport and QueryRenderer in my react app.

The problem is: I need to handle the token-expired(or invalid) situation (maybe to renew a token or logout user). But I can not find any way except to use error.toString().match(/Not\sauthorized/). It's not robust.

Is there any other way?

Guida contributor