Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Uplift: For fenix#16232 - Make sure we cancel any in-progress auth #8978

Merged
merged 1 commit into from
Nov 14, 2020

Conversation

st3fan
Copy link
Contributor

@st3fan st3fan commented Nov 14, 2020

Uplift: For fenix#16232 - Make sure we cancel any in-progress auth

Prior to #7856 we only had a NotAuthenticated
state, which user would remain in until the very end of the authentication process (receiving a 'finished...' api call).

After the refactor, we introduced an in-progress states - specifically, BeginningAuthentication. If the user
cancels the auth flow (e.g. closes a custom tab), they will remain in this state. Subsequent login attempts
would then fail.

This patch fixes this by introducing a Cancel event which we trigger whenever handling 'beginAuthentication' calls.
In normal scenarios, this event is ignored. Otherwise, it "resets" the state machine into NotAuthenticated
state before emitting any Begin* events.

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

Prior to #7856 we only had a NotAuthenticated
state, which user would remain in until the very end of the authentication process (receiving a 'finished...' api call).

After the refactor, we introduced an in-progress states - specifically, BeginningAuthentication. If the user
cancels the auth flow (e.g. closes a custom tab), they will remain in this state. Subsequent login attempts
would then fail.

This patch fixes this by introducing a Cancel event which we trigger whenever handling 'beginAuthentication' calls.
In normal scenarios, this event is ignored. Otherwise, it "resets" the state machine into NotAuthenticated
state before emitting any Begin* events.
@st3fan st3fan added the 🛬 needs landing PRs that are ready to land label Nov 14, 2020
@st3fan st3fan merged commit e239163 into releases/63.0 Nov 14, 2020
@bors bors bot deleted the st3fan/fxa-uplift branch November 14, 2020 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛬 needs landing PRs that are ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant