feat: make auth flows stateless [WPB-16058] #3871
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Currently, when the app needs to change the server config to a custom one, it keeps it in a global app state
AuthServerConfigProvider
that's stored as long as the app is running. It creates some issues after logging in on custom backend, the config to be used next as a default one will be the last one that was used, not the default one for the build, but if the user closes the app and opens again then it resets so it's confusing. It's even more complicated in case of SSO login as the server config can be changed to a different one during the single login flow and it can affect the whole app.This PR is to make auth flows stateless. When the app wants to start the login flow for any custom config, then it's passed as a navigation parameter and used only during this particular login flow, so when the user closes it or changes to another one then it just opens again with a different one and there are no issues with changing current config or persisting it for the whole app and keeping it synced. The only place where it wasn't so streamlined was SSO login - when user logs in via SSO with a custom config in a browser, then the app doesn't get the SSO result deeplink with custom backend data, so it needs to be kept and passed from one step to another, but in that case it's stored in
savedStateHandle
of a login flow parent and thanks to that it still keeps the stateless properties from a login flow perspective - when the flow is finished/canceled then this custom config is just dropped and doesn't affect any other started login flow.TLDR:
AuthServerConfigProvider
is removed and custom config is being passed as a navigation parameter.Testing
Test Coverage (Optional)
How to Test
Log in using custom config.
PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.