-
Notifications
You must be signed in to change notification settings - Fork 356
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
[CORL-3008] when auth token is invalid, clear it and reload the stream #4472
Conversation
✅ Deploy Preview for gallant-galileo-14878c canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Approving, with 2 small comments.
@@ -111,6 +111,8 @@ interface CreateContextArguments { | |||
* of the render window | |||
*/ | |||
customScrollContainer?: HTMLElement; | |||
|
|||
onAuthError?: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment here explaining onAuthError
, consistent with other args?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
@@ -99,6 +102,13 @@ export async function attach(options: AttachOptions) { | |||
await new Promise((resolve) => options.refreshAccessToken!(resolve)); | |||
} | |||
|
|||
const onContextAuthError = async () => { | |||
const localStorage = resolveStorage("localStorage"); | |||
await localStorage.removeItem("v2:accessToken"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be updated to also use the ACCESS_TOKEN_KEY
already defined in client framework
?
What does this PR do?
Makes it so that the stream clears the user's auth token when it is invalid or expired and reloads the stream so they can view comments, log in again, and continue using Coral.
These changes will impact:
What changes to the GraphQL/Database Schema does this PR introduce?
None
Does this PR introduce any new environment variables or feature flags?
No
If any indexes were added, were they added to
INDEXES.md
?No new indices
How do I test this PR?
npm run watch
on both server and clienthttp://localhost:8080
with a user accountcoral
database in Mongonpm run start:development
http://localhost:3000/install
npm run watch
for the serverhttp://localhost:8080
coral:v2:accessToken
storage key and the stream shows up in the signed out stateWere any tests migrated to React Testing Library?
No
How do we deploy this PR?
No special considerations.