fix(clerk_auth): offline sign out#403
Open
MarkOSullivan94 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #401
This pull request addresses a critical bug in the sign-out flow when the device is offline and improves test support for simulating network conditions. The main fix ensures that local authentication state and credentials are cleared immediately during sign-out, even if the network is unavailable, preventing unintended silent re-authentication when connectivity returns. Additional changes enhance the mock HTTP service to better support offline scenarios and make tests more comprehensive and reliable.
Bug Fixes:
_tokenCache.clear()is called at the start of the_deletemethod inApi, so credentials are cleared immediately during sign-out, regardless of network success or failure. [1] [2]Test Infrastructure Improvements:
isOfflineflag toMockHttpServiceto simulate offline behavior, causing network calls to throw aSocketExceptionandpingto returnfalse. [1] [2] [3]addAuthenticatedClientWithSessionResponsetoMockHttpServicefor easier setup of authenticated client states in tests.reset()also resets theisOfflineflag inMockHttpService.New Tests:
sign_out_offline_test.dartto verify that signing out while offline clears credentials and prevents silent re-authentication when connectivity returns, and that no credentials are sent in subsequent requests.Test Configuration:
TestAuthConfigfor more predictable test behavior.