Skip to content

fix(auth): add protected data unavailable error #3990

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

harsh62
Copy link
Member

@harsh62 harsh62 commented May 6, 2025

Issue #

Description

We’ve been investigating and believe the root cause is related to iOS application lifecycle behavior—specifically prewarming and protected data access. When the app is launched in the background (e.g., after device reboot or during system prewarming), UserDefaults and Keychain data may be inaccessible because protected data is not yet available. Amplify attempts to read credentials during this phase, fails to find them, and interprets it as corruption—triggering an unexpected AuthError and wiping the credentials.

Apple Documentation: https://developer.apple.com/documentation/uikit/about-the-app-launch-sequence.

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 May 6, 2025 22:52
thisisabhash
thisisabhash previously approved these changes May 7, 2025
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