Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear access token on expiration or auth error #105

Merged

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Sep 15, 2023

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

✨ Test out this PR locally via:

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
Copy link

linear bot commented Sep 15, 2023

AP-3631 Log user out when API token expires

Let's do the equivalent of AP-3255 in the VT addon. We can address AP-3254 later.

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

src/utils/graphQLClient.tsx Outdated Show resolved Hide resolved
src/utils/graphQLClient.tsx Outdated Show resolved Hide resolved
src/utils/graphQLClient.tsx Show resolved Hide resolved
@ghengeveld
Copy link
Member Author

ghengeveld commented Sep 20, 2023

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
Copy link
Member

Nice!

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, works well

@ghengeveld ghengeveld force-pushed the ghengeveld/ap-3631-log-user-out-when-api-token-expires branch 3 times, most recently from c6177ba to 1f9f4b0 Compare September 20, 2023 10:49
@ghengeveld ghengeveld merged commit a2db607 into main Sep 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants