-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix OpenApp
failures due to expired authToken
#11151
Conversation
…ticate. no need to try to prevent reauthentication attempts
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.
My best idea for how to achieve this is to just set up a local promise to hook other reauthenticate requests into and ensure we are only ever re-authenticating once. Like... function reauthenticate(commandName) {
if (isAuthenticating) {
return isAuthenticating;
}
isAuthenticating = Authentication.reauthenticate(commandName)
.then((response) => {
isAuthenticating = null;
return response;
});
return isAuthenticating;
} |
It worked pretty good
|
That worked really well 😄 |
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.
LGTM and tests well!
|
@ctkochan22 I'm gonna hit the merge on this one so we can scratch this off the list, but lmk if you spot anything that needs to be addressed. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @marcaaron in version: 1.2.5-0 🚀
|
🚀 Deployed to production by @luacmartins in version: 1.2.5-2 🚀
|
cc @luacmartins
Details
This is kind of a quick fix, but I think in the longer term we will want to:
Here's the basic logic behind this PR...
READ
requests andmakeRequestWithSideEffects
were originally envisioned to be non-retryable requestsread
ormakeRequestWithSideEffects
failsmakeRequestWithSideEffects
we'll want the original response returned so we will chain them like we do requests in the sequential queueread
then we will reauthenticate but not call the original request directly and instead trigger the reconnection callbacks so that any registered fetchData() calls can be updated now that we have the new authToken from the authenticate response.Weird stuff...
I also noticed that some writes that started after read requests failed because they also require re-authentication. It didn't make sense that we would encounter that situation before since two writes can't possibly happen simultaneously and reauthentication is blocking in the sequential queue.
I think it would be fairly safe to just remove that logic and if we are already reauthenticating then just let another reauthentication happen. So that's my general plan for this.
Fixed Issues
$ #11081
Tests
ReconnectApp
eventually returns 200 jsonCodePR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android