Bug 2059169 - Allow CheckAuthorizationStatus from more states - #7514
Conversation
|
What's the motivation here? Do we ever expect |
ie, if it ever did resolve itself, it implies there was a bug which caused us to get into |
|
oops, I see the info in the bug. It's a little sad, but I think this is fine. |
Not really. Should it be a no-op as well?
Agreed. It's kind of weird but I don't think the current Android behavior is too unreasonable. |
This seems fine I guess. I'd like to better understand the Android weirdness (but not enough to actually dig into it :) but given it exists, this isn't going to hurt. |
|
just noticed we do record some telemetry here - "Account Manager recovered a broken FxA auth state, without direct user involvement.". It would be interesting to see that - I don't think it would have great UX |
Oh. Given that the defined that telemetry, I'm going to keep the check from the AuthIssues state. One scenario I could imagine is they see a 401 error for normal reasons, maybe they tried to use an expired auth token or something, then the first auth check fails with a network error so they move to
Other than the above weirdness, the other part is here. Whenever they see an auth error, they queue an operation that ends with sending us |
Yeah, exactly - I'd call it a bug that a network error caused this in the first place, so if we can get evidence of that we should track it down. I'm kinda thinking that all these extra users who suddenly show up in all our stats might be something like this - we end up kinda permanently leaving them in a needs-reauth state. You patch seems fine, but isn't going to be a panacea - it still relies on the app trying the transition, which I don't think it expects to do in normal cases - once we are in an authissues state I expect we just stay there and don't check the auth status again in the usual cases? |
The hypothetical scenario is that there's a real, but recoverable, auth error. However, when we try to recover we get the network error. In that case, I feel like |
I don't think that exists.
The thing is, we aren't trying to recover - we think there's a possibility we are in a bad auth state. Failing to check that should not put us in one. Conceptually, this is no different from startup. If we startup without a network connection you couldn't argue we should go to AuthIssues, even though there's quite a good chance we are disconnected as it's been some time since we last checked. |
|
("recoverable" implies some action we take, but there's never any action we do take here, right? ie, I'm saying the only thing we do that qualifies as "recovery" is to prompt for a password) |
Hmm. At one point I thought it was common, but I can't think of a realistic scenario anymore. The best one I can come up with is you messed with your clock and have an expired auth token, but our code can't detect it.
That's a good point. Maybe we should never move to |
The session and refresh tokens never expire.
Yep, that's exactly what I think should happen.
subtle but important point here - there's no move "back to Connected" - it's that we never leave connected just due to a network error |
|
And to further clarify:
This reads better as "concrete affirmation that the auth status is bad" or something - the term "failure" is somewhat misleading here - the request to check the auth status must work with a result that tells us the status is bad - there's no "failure" here. |
|
That logic make sense to me. I made https://bugzilla.mozilla.org/show_bug.cgi?id=2060539 for updating the state machine. I also made https://bugzilla.mozilla.org/show_bug.cgi?id=2060541, for trying to recover every so often since we have some current users that are in |
Pull Request checklist
[ci full]to the PR title.