Bug 2060541 - Recheck auth status on startup, weekly - #7564
Conversation
|
I have been thinking a fair amount about the part of this patch that I'm the least sure about: the part in |
|
I ended up not putting the logic to reset the auth timer in |
bendk
left a comment
There was a problem hiding this comment.
This is looking very good. Thanks for updating the example client.
I had a couple suggestions, but the only blocker is figuring out how we should store the refresh token when we're in the auth-issues state.
| last_seen_profile: None, | ||
| access_token_cache: HashMap::new(), | ||
| logged_out_from_auth_issues: false, | ||
| last_auth_recheck_time: None, |
There was a problem hiding this comment.
I see your point about resetting this timer and the Unititialized -> AuthIssues transition. My one idea here is to rename this to last_auth_check_time and set it in whenever check_authorization_status() is called (or maybe just whenever it fails?). I think that might give you the timer you need without the having to call reset_auth_recheck_timer in so many places. However, I'm not sure and I'm okay with the repetition if that's what we need to do. However you want to handle this is fine with me.
There was a problem hiding this comment.
My concern with this solution is that there are other ways that we can get into the AuthIssues state. Here, for example. With the proposed design, that line (and several others) would put us into the AuthIssues state and then we would re-check on the very next initialization. I assume that this isn't really the behavior that we want.
There was a problem hiding this comment.
I suspect that the those cases are buggy and we should fix those. For example, I think we should just get rid of the CallGetProfile event. Can you make a list of the other cases where you think there could be an issue? I'd love to go through them.
In the meantime, maybe we should just leave this code as-is. I don't want block this PR on figuring all that out.
There was a problem hiding this comment.
Aside from the one listed above, there is:
- This one where we initialize into the
Connectedstate, butaccount.finish_initializefails. - This one where we get the
WebChannelPasswordChangeevent from theConnectedstate andhandle_web_channel_password_changefails. - This one where we are in the
AuthIssuesstate, get theBeginOAuthFlowevent, andbegin_oauth_flowfails. - This one where we are in the
AuthIssuesstate, get theWebChannelPasswordChangeevent, andhandle_web_channel_password_changefails.
There was a problem hiding this comment.
Another possibility here is that we could just accept the behavior of doing one check on the very next initialization after the AuthIssues transition. That would simplify the code a bit since we would only reset the timer in one place. And if we did somehow end up in a situation where someone was frequently getting into that state, it would fix itself quickly instead of fixing itself once a week.
The pull request has been modified, dismissing previous reviews.
Pull Request checklist
cargo testsucceeds locally.cargo fxa force-auth-issuescommand to the example CLI client in order to be able to test this manually.