Search code examples
swiftauthenticationpasswordskeychainswift4

Fetch all logins from SharedWebCredential


Is it possible to fetch all logins (url, username and password), from all stored passwords on a device (iPhone, iPad, ...)?

I found in the Apple Documentation this: "SharedWebCredential". But "SharedWebCredential" seems for an App and for the counterpart website, for a faster login. Introduction for SharedWebCredential

Now my question: Is it possible, to fetch all logins via SharedWebCredential?

hint: I will only read the logins, not rewrite them.


Solution

  • No, that's very insecure/invasive and the protocol has been designed to prevent that.

    Here is Apple's config guide for this API. You must place an entitlement key in your app for each domain you want credentials for and each listed domain must include your app ID at https://<domain>/apple-app-site-association.

    If you simply want the user to be able to fill passwords into your text fields you can mark the fields as type "Username" and type "Password (secure)" and the iOS 11 keyboard will pop up a key icon which the user can tap and then pick the specific credential pair they want to fill.