Retry Passkey signup after the user has cancelled. (ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest)

When trying to sign a user up using passkeys I create a request using: createCredentialRegistrationRequest when performing this request with performRequests all goes well. When a user cancels this request by pressing the X on the system modal that is presented I correctly receive a canceled event through authorizationController(controller:, didCompleteWithError:). Now if I retry the request I do not get a popup or a canceled error but instead I get the following:

["NSLocalizedFailureReason": Request already in progress for specified application identifier.]

Is there a way to present the registration/signup with passkeys modal again after the user has cancelled it? For example when a user dismisses the system modal but later decides to press the "create account" button again. As far as I can see now if the user cancels the request once you can never show the modal again.

Replies

I found out that you can call cancel on the ASAuthorizationController and try again. Still does not make sense to me why you should have to do that. If you get an ASAuthorizationError with code cancelled you would assume the request is canceled and that you don't have to cancel it manually again. (Seems like a bug)

My understanding of the flow as you've described it:

  1. Initiate a credential registration request. The sheet comes up.
  2. User presses the x button in the sheet.
  3. You receive a delegate callback with a canceled error.
  4. Initiate a second credential registration request.

That flow is supported, and there should be no need to manually invoke cancel after receiving a canceled error. First make sure you don't have another request, perhaps a background AutoFIll-assisted request. If you've verified that and are still seeing the issue, please file this through Feedback Assistant and share the feedback number here so I can take a look :)

By any chance are u seeing this issue while testing with the Shiny sample app. If so one thing I noticed was

  • In SignInViewController
  • When the view appears, we trigger a modal get request line:32
  • If the user cancels it then as part of the error observer line:36, we trigger a autofill request so we are ready to autofill
  • From this point on if we try to click on "Create Account", it just fails because there is a autofill request in progress.

One modification I had to do was do a cancel() on the ASAuthorizationController which triggered the autofill request whenever the user explicitly clicks on "Create Account" in the sample app