Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Auth): Resolve AuthZ state correctly when in error state #3762

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

harsh62
Copy link
Member

@harsh62 harsh62 commented Jun 25, 2024

Description

The issue aims to fix a use case where if the AuthPlugin was initialized into an error state. This resulted in subsequent fetchAuthSession to fail due to an error state not handled correctly.

Scenario:

  • Initialize Amplify and call fetchAuthSession API while offline.
  • Observe Amplify throwing the correct service error
  • Go back online and call the fetchAuthSession API again.

Expected: the API to return results
Bug: The API returned a service error that was previously cached.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@harsh62 harsh62 requested a review from a team as a code owner June 25, 2024 01:38
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.44%. Comparing base (9ed6c1c) to head (f494bef).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3762      +/-   ##
==========================================
+ Coverage   68.43%   68.44%   +0.01%     
==========================================
  Files        1079     1079              
  Lines       37573    37571       -2     
==========================================
+ Hits        25712    25717       +5     
+ Misses      11861    11854       -7     
Flag Coverage Δ
API_plugin_unit_test 68.83% <ø> (ø)
AWSPluginsCore 68.56% <ø> (+0.14%) ⬆️
Amplify 47.59% <ø> (-0.07%) ⬇️
Analytics_plugin_unit_test 84.52% <ø> (ø)
Auth_plugin_unit_test 79.47% <100.00%> (+0.11%) ⬆️
DataStore_plugin_unit_test 81.23% <ø> (-0.06%) ⬇️
Geo_plugin_unit_test 72.00% <ø> (ø)
Logging_plugin_unit_test 62.95% <ø> (ø)
Predictions_plugin_unit_test 37.32% <ø> (ø)
PushNotifications_plugin_unit_test 86.21% <ø> (ø)
Storage_plugin_unit_test 76.75% <ø> (ø)
unit_tests 68.44% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@harsh62 harsh62 merged commit 3abc90b into main Jun 25, 2024
79 checks passed
@harsh62 harsh62 deleted the session-error-resolved branch June 25, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants