I tried to use preferImmediatelyAvailableCredentials option in my sign in via Passkey process and expected to see this logic: If passkey isn’t available (for some reason, for example, user deleted it) the sign up modal sheet appears. But instead of this I got ‘Choose how you’d like in sign in’ sheet. As I understand, preferImmediatelyAvailableCredentials should allow me to fallback to sign up and skip this step but it doesn’t. My code is:
func signIn(credId: String) {
currentAuthController?.cancel()
let securityKeyProvider = ASAuthorizationSecurityKeyPublicKeyCredentialProvider(relyingPartyIdentifier: domain)
let publicKeyCredentialProvider = ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: domain)
let assertionRequest = publicKeyCredentialProvider.createCredentialAssertionRequest(challenge: challengeData)
let securityKeyRequest = securityKeyProvider.createCredentialAssertionRequest(challenge: challengeData)
if let data = Data(base64urlEncoded: credId) {
let cred = ASAuthorizationPlatformPublicKeyCredentialDescriptor(credentialID: data)
assertionRequest.allowedCredentials = [cred]
}
let requests = [assertionRequest, securityKeyRequest]
let authController = ASAuthorizationController(authorizationRequests: requests)
authController.delegate = self
authController.presentationContextProvider = self
currentAuthController = authController
authController.performRequests(options: .preferImmediatelyAvailableCredentials)
}