Skip to content

AppCheck error on iCloud Restore #15161

@aroe01

Description

@aroe01

Description

Hi All,
We are experiencing an AppCheck error for some users, our best guess is that its occurring when an existing user gets a new device and runs the app after an iCloud restore.
The initial call to Auth signIn fails with internalError = 17999. We previously found a forum that suggested in this case to attempt AppCheck.appCheck().token(forcingRefresh: true) which we do but it returns with the following error: The operation couldn’t be completed. Failed to attest the validity of the generated cryptographic key (attestKey:clientDataHash:completionHandler:); keyId.length = 44, clientDataHash = cJKEhtFXhVI1hEP2XFYZz6P0V2MelcU
It seems like maybe the issue is that the keychain isnt restored on iCloud restore but maybe the reference to it in userDefaults (or elsewhere) still remains. Looking at the code it seems like an error in this process would trigger resetAttestation, but users experiencing this error continue to experience it repeatedly, blocked from using the app.
Any guidance or fix on this issue would be greatly appreciated.

Reproducing the issue

No response

Firebase SDK Version

11.15.0

Xcode Version

16.4

Installation Method

Swift Package Manager

Firebase Product(s)

App Check

Targeted Platforms

iOS

Relevant Log Output

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions