Using Keychain to autofill web page username/password

I’m using HTMLViewer to go to arbitrary web sites and am trying to replicate the Autofill function in Safari in which login information is automatically recalled from Keychain and used to fill in usernames and passwords? Has anyone used with the built-in Xojo Keychain class or the MBS Keychain classes for this purpose? I envision creating my own keychain and using the MBS JS classes to inject the username/password when a corresponding web page loads.

Well, yes. I and surely others have read passwords from the Keychain. What’s your particular question? The LR and docs helped me pretty well, what do you need help with, then?

Writing and reading values to a private keychain doesn’t seem difficult. But how does one deal with storing the URL associated with each username/password combination, so that when that page loads my app will look for the corresponding login fields and populate them. MBS has a function for AddInternetPassword, but I’m not sure that would work for web forms (username and pw login forms). I’m slowly hacking an approach, but there is a lot of trial and error (and error).

If you look at the Keychain items that Safari stores in the Keychain, you’ll see that it sets the keychain item’s “Name” to the website’s domain name. You could do the same, and then find all items matching such domain name. There’s also the comment field which you might use for your purposes, I guess (not sure how to access that from Code, though).

I think I’ve gotten a handle on keychain using the MBS plugin (the Xojo version is too limited). But I’m stumped at the stage of collecting the username/password. That should be done when the login form is submitted. But I don’t see how to trap that event in HTMLViewer to get the submitted data…