-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[No QA] Cleanup Authentication error handling #8865
Conversation
…n tests. Stop throwing errors when things cannot be retried Use unable to retry add message to throw in reauthenticate use UNABLE_TO_RETRY
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.
Looks solid!
Ah shucks I got conflicts. Fixed now 🙇 |
cc @Luke9389 able to give this a quick look? |
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.
Nice, this looks great.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
You may want to App/src/libs/actions/Session/index.js Lines 199 to 202 in 8d6368e
Otherwise, chained handlers like this will get undefined instead of the response and crash. I got this because I was testing something with an expired shortl-ived auth token, you get stuck with an infinite loading spinner. Update: the infinite spinner was there before I think. It happens also if you throw how we used to. So my suggestion doesn't fix that problem at all :) |
@aldo-expensify Nice catch. I think returning the response could work and would just mean we would continue and set the same error to account again? But why is the call to |
Yeah, I think this wasn't working properly before your changes... so we can treat it separately.
I was trying to reproduce the infinite spinner + error this user is getting here: https://github.com/Expensify/Expensify/issues/202627 and noticed that we get similar symptoms with an expired short lived auth token I got the expired token by reusing the URL that takes you to New Dot. While this is a weird case, I think we should fix it and probably kick the user to the login screen. Do you agree with taking the user to the login screen? or are we handling expired sessions some other ways?
I'm somewhat concern about the user not being able to use NewDot for a long time now, but I cannot tell yet if this would fix the problem for the user or not. I'm ok with trying to find a solution if your plate is full, and if I find out that this is not related to the problem the user is having, I can even leave it for external contributors. |
Hmm I'm not sure if I agree because I'm not sure if I understand what is happening. What are the reproduction steps? If the short lived token is expired I think one of two things would be true...
cc @neil-marcellini who has looked into these flows a ton and might have better context. |
For now, I will just patch this so the behavior is the same at least and not throw any errors. |
🚀 Cherry-picked to staging by @sketchydroide in version: 1.1.57-8 🚀
|
Details
More cleanup for the Network code. The code should work the same as before and no new behavior is being added.
Summary of Changes
Authenticate()
to a util so we don't have to throw anError
insideAPI.Authenticate()
.then()
of an API commandreauthenticate()
.catch()
was implemented as they were previously handling aCONST.ERROR.API_OFFLINE
and now need to handle aCONST.JSON_CODE.UNABLE_TO_RETRY
.Fixed Issues
$ #8864
Tests
No specific QA other than to make sure reauthentication flows are working.
PR Review Checklist
PR Reviewer Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followed/** 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
No specific QA other than to make sure reauthentication flows are working.
Screenshots
❌