I want to implement passkey in my app. I am wondering if there is a robust way to distinguish between these two situations: the user cancels the action sheet (ASAuthorizationController) there are no credentials at all Both situations give a canceled error. I noticed a localized string in NSError.userInfo explaining the reason in situation 2, but this is not a robust way of distinguishing between them because the behavior can change in the future.
3 Answers
The ASAuthorizationController API for passkeys is based around WebAuthn and WebAuthn deliberately does not distinguish these situations for privacy reasons. While the privacy considerations for a native app may be different, this is probably why ASAuthorizationController is making these failures (mostly) the same.

- 1,129
- 5
- 6
These two cases are not meant to be distinguished programmatically. For privacy reasons, and you're right that the userInfo shouldn't be relied upon. You likely want to either use AutoFill-assisted requests, or perform a modal request with a silent fallback (i.e. no UI gets displayed you get the cancel callback immediately if there are no credentials). These options are displayed in detail in the Meet passkeys developer session. For simpler implementation I'd use passkeys.com

- 2,185
- 2
- 11
- 17