Skip to content

AppCheck with AppAttest getToken producing occasional com.apple.devicecheck.error Code=2 #11264

@mattpis-cgi

Description

@mattpis-cgi

Description

Background:

We have rolled out app check to prod over a month ago and we use appcheck to secure our back end.
We dont use it in combination with other firebase frameworks. Our application min iOS version is 15.0. Firebase version is 10.6
For most of our users, AppCheck get token succeeds. We are experiencing issues with small number of users, approximately 10-5%.

Issues:

1: Most of our getToken failures result with error:

error Domain=com.apple.devicecheck.error Code=2 

This error is produced by apples attestation API. Apple docs about error:
https://developer.apple.com/documentation/devicecheck/dcerror/code/invalidinput

Description says:

An error code that indicates when your app provides data that isn’t formatted correctly.
  1. Occasionally we receive:
 Error Domain=com.apple.devicecheck.error Code=3 

This error is also produced by apples attestation API. Apple docs about error:
https://developer.apple.com/documentation/devicecheck/dcerror/code/invalidkey
Description says:

You receive this error if something goes wrong with generating, retrieving, or using an App Attest cryptographic key, when:
- we attestKey
- we generateAssertion
- app Attest service rejects the key.

Investigation:

We did try to reproduce with no luck on multiple devices. We tried:

  • change region, time and date.
  • multiple iOS versions.
  • use iCloud keychain storage to retain its data between installations, since framework uses it as a storage.

Non of the above did not help in reproducing the issue.

We are looking for clues and we ask for help to solve this.

Reproducing the issue

Hard to reproduce. We failed to reproduce it.

Firebase SDK Version

10.1

Xcode Version

14.1

Installation Method

Zip

Firebase Product(s)

App Check

Targeted Platforms

iOS

Relevant Log Output

No response

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions