-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Return data
from Reauthentication
middleware when shouldRetry: false
#9961
Conversation
…equest.resolve promise
|
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! Thanks for fixing this!
@@ -343,6 +343,11 @@ function invalidateCredentials() { | |||
Onyx.merge(ONYXKEYS.CREDENTIALS, {autoGeneratedLogin: '', autoGeneratedPassword: ''}); | |||
} | |||
|
|||
function invalidateAuthToken() { | |||
NetworkStore.setAuthToken('pizza'); | |||
Onyx.merge(ONYXKEYS.SESSION, {authToken: 'pizza'}); |
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.
pizza
? lol, did you mean to clear it here instead or actually leave it as pizza?
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.
lol seems like we were already doing that in TestToolsMenu haha. I like it :)
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.
🍕 if we set it as null the user would be logged out or other weird things. So "bad authToken" vs. "no authToken" is what we want.
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.
cool, can that be added as a comment so that its not easily forgotten for the next person updating this block.
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.
Anyway, im not going to block since adding a comment is a NAB. Going to approve and merge this since its the only thing blocking deploy.
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. Merging before andrew can review to get this out the door sooner.
…cationIssue Return `data` from `Reauthentication` middleware when `shouldRetry: false` (cherry picked from commit dd9c8f5)
…9961 🍒 Cherry pick PR #9961 to staging 🍒
Nice, thanks for this! |
🚀 Deployed to production by @chiragsalian in version: 1.1.84-13 🚀
|
Details
cc @yuwenmemon @luacmartins
When we switched from using
makeRequestWithSideEffects()
instead of the "main queue" (a.k.a. deprecatedAPI) for authenticating Pusher we changed the way those responses are handled when theauthToken
expires. Previously, arequest.resolve
function was provided to the request object so the original response could be processed by the original caller whenshouldRetry: false
istrue
. Since we do not pass this promise the response data is never returned and Pusher's custom authorizer can't handle the response or reauthentication attempts.Fixed Issues
$ #9958
Tests
There isn't a clear natural reproduction for the linked issue other than waiting a long time for the
authToken
to expire and I am mostly following the trail of logs, but manually killing theauthToken
seems to work and we can do it via the "Preferences" on dev or staging.See QA Steps
PR 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
getPusherInstance()
in the JS console and verifying that the private user channel issubscribed: true
If this test is repeated without the line of code changing to return the data we will no longer be subscribed.
Screenshots
Web
Mobile Web
Desktop
iOS
Android