How can I have iOS Safari remember credentials for websites with HTTP(S) Basic Authentication?

Solution 1:

Safari does not support saving the credentials for basic authentication. That's why you're not asked to store it.

There are basically three work-arounds you can use:

The first is simply to create a bookmark that contains your credentials. Note that this should only be done if the credentials aren't "important" - like for example if this is one of those commercial web sites that allow anyone in that knows that this year's password is "2019" or something like that. Then you can create a bookmark for the URL like this:

http://user:[email protected]/

When you open that bookmark, you'll not be asked for credentials, but will be logged in automatically.

If you require an ordinary amount of security regarding the saved credentials, you can instead use a different work around. On your device, access Settings and then Passwords & Accounts and then App & Website Passwords. At the top is a + icon that you can click to add your web site and the username and password.

Contrary to form based password authentication, the information you enter there will not be automatically filled out. However when you get the username/password popup, you have the option of clicking the little "key" icon to select the stored credentials.

The third possible work-around is to use a Mac logged in to the same iCloud account with Keychain enabled. Access the web site using Safari on the Mac, and you'll be able to store the credentials.

On the iOS device the credentials will not be automatically filled out, but you will be able to press the "lock" icon in the popup to allow choosing the credentials you've stored on the Mac.

Solution 2:

In iOS 15, Settings > Passwords allows adding new entries by hand. You can fill in the website URL and the credentials here. The next time the basic auth dialog shows up, it will not, unfortunately, be pre-filled, but you will be presented with the Passwords button in your on-screen keyboards once you focus either of the username / password fields and from there you can pick the credentials. It's not completely straight-forward, but it is the best option I found, especially because some websites do not support reading the username and password from the URL, only from the HTTP header, so the trick with the bookmark with the credentials in it doesn't work everywhere.