skip to Main Content

Is it possible to check if device has any passkeys stored or not?
Context:
I need to sign in with passkeys only if there is saved one. I don’t want to show QR code and scan it with other device. My goal is to show passkeys system popup only if there is at least one passkey stored for specific domain.

2

Answers


  1. There isn’t a direct way to determine if a device has a passkey for the given domain. Currently, the best approach is to utilize conditional UI autofill without implementing some kind of device tracking mechanism on the backend.

    Login or Signup to reply.
  2. If you want to avoid the QR option for authenticating from a nearby device, set the ASAuthorizationController with the option preferImmediatelyAvailableCredentials:

    // Pass in any mix of supported sign-in request types.   
    let authController = ASAuthorizationController(authorizationRequests:[assertionRequest, passwordRequest])
    
    // If credentials are available, presents a modal sign-in sheet.
    // If there are no locally saved credentials, no UI appears and
    // the system passes ASAuthorizationError.Code.canceled to call
    // `AccountManager.authorizationController(controller:didCompleteWithError:)`.
    authController.performRequests(options: .preferImmediatelyAvailableCredentials)
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search