chromaui / addon-visual-tests

Visual Tests addon for Storybook
MIT License
33 stars 2 forks source link

Clear access token on expiration or auth error #105

Closed ghengeveld closed 11 months ago

ghengeveld commented 12 months ago

Clears the access token from memory and localStorage when either the token expires or the API returns either an auth error or no viewer data.

I've updated our setup to use URQL's authExchange rather than our own custom header injection. This makes it a little more "intelligent" about not sending a request if we already know it will fail. It also is able to automatically retry a request after refreshing the token (e.g. using a refreshToken) but we don't have that capability yet.

📦 Published PR as canary version: 0.0.88--canary.105.7ed4611.0
:sparkles: Test out this PR locally via: ```bash npm install @chromaui/addon-visual-tests@0.0.88--canary.105.7ed4611.0 # or yarn add @chromaui/addon-visual-tests@0.0.88--canary.105.7ed4611.0 ```
linear[bot] commented 12 months ago
AP-3631 Log user out when API token expires

Let's do the equivalent of [AP-3255](https://linear.app/chromaui/issue/AP-3255/add-a-oauth-token-expiration-bandaid) in the VT addon. We can address [AP-3254](https://linear.app/chromaui/issue/AP-3254/public-api-tokens-expire-and-dont-get-refreshed) later.

ghengeveld commented 11 months ago

Looks good although I have some questions. How to QA this?

@tmeasday I just manually messed up (edited) my JWT in localStorage to make it invalid.

tmeasday commented 11 months ago

Nice!