ASAuthorizationPasswordProvider request not finding shared web credentials

I'm trying to deprecate iOS 13 from my app. One of the compilation warnings I got as a result was:

'SecRequestSharedWebCredential' is deprecated: first deprecated in iOS 14.0 - Use ASAuthorizationController to make an ASAuthorizationPasswordRequest (AuthenticationServices framework)

So I tried updating my code as follows

            let provider = ASAuthorizationPasswordProvider()
            let request = provider.createRequest()
            let authorizationController = ASAuthorizationController(authorizationRequests: [request])
            authorizationController.delegate = self
            authorizationController.presentationContextProvider = self
            authorizationController.performRequests()

But it always calls the delegate callback

func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error)

with error

Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1001 "No credentials available for login." UserInfo={NSLocalizedFailureReason=No credentials available for login.}

Even though the device (or simulator) has a stored password for my website. I have my website as an "associated domain" for my app of type webcredentials.

What am I doing wrong here?

Post not yet marked as solved Up vote post of tracyk Down vote post of tracyk
3.2k views

Replies

If you silence the deprecation warning from SecRequestSharedWebCredential, does it show you the passwords that you expect?

  • So to more directly answer your question: yes, I see the expected passwords with the deprecated code.

Add a Comment

I haven't tried compiling the app with iOS 14 min version yet (lots of other code changes to deal with first), but the SecRequestSharedWebCredential code from before is still working in iOS 14 and 15 devices when compiling the app for 13+.

I seem to have come across this exact scenario during the migrations required to drop iOS 13. I don't suppose someone has found a solution?

I am also facing the exact same problem. I confirmed that associated domain setting is correct, and implementation with SecRequestSharedWebCredential works fine. Is there any solution?

One note: I got different error from different iOS version. Not sure if it is related.

iOS14.8.1

Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1000 "(null)"

iOS15.2.1

Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1001 "No credentials available for login." UserInfo={NSLocalizedFailureReason=No credentials available for login.}

Is this issue resolved? I am facing the issue, too. I am testing the shared web credentials. I am sure that the apple-app-site-association is correct and the associated domains is also correct. but I am still getting this error below.

Error encountered: Error Domain=com.apple.AuthenticationServices.AuthorizationError Code=1001 "No credentials available for login." UserInfo={NSLocalizedFailureReason=No credentials available for login.}

Anyone find a solution to this?