Web Login With Keychain

The Store and Retrieve Keychain Passwords topic shows how to use the Keychain to hold your passwords and then use them securely. A common use case for this is to access a web site.

Here is an example showing how to do this.

The process is pretty simple - open the web page, wait for it to finish loading, and then fill in the form with the username and password and then submit the form.

Hopefully the web page will be well and simply designed, and then Keyboard Maestro's Safari popup menus in the actions will let you fill int eh details fairly simply. Otherwise you may have to resort to using some manual JavaScript to enter the fields, or instead using some UI scripting (like clicking or tabbing between fields).

Web Login With Keychain.kmmacros (3.5 KB)

3 Likes

Thanks so much for that Peter. I've recently started using Chrome and the lack of keychain support has been bugging me - always better to have one set of passwords up to date rather than some with Chrome and some in keychain.

Anyway, I've tried adapting your idea to suit Paypal and it didn't work so I thought I would try a simplified version and build from there. All I'm trying to do is have the password from keychain appear in the password field on the Paypal login screen but it doesn't work - it mustn't be finding the password in keychain.

This is what I've got so far...

Any advice or assistance would be gratefully appreciated!

Cheers

Aaron

That second action does nothing. It is setting the variable “Password” to the token expansion of “%Variable%Password%” which itself is just the value of the variable Password.

Use a Set Google Chrome Text Field action.

Thanks Peter for your reply!

I deleted the last action and added 'Set Google Chrome Field to Text' but I must still be doing something wrong...sorry, slow learner as nothing is appearing in the password field when I activate the macro :smile:

Thanks for your continued assistance with this.

Cheers

Aaron

It looks fine to me.

And worked fine with Safari when I just tried it.

The Chrome (and Safari) actions work by making AppleScript requests.

Chrome’s auto-update mechanism seems to frequently break the AppleScript connections.

Restarting Google Chrome, Keyboard Maestro Engine, or restarting your Mac will usually resolve the broken connection.

Although if the Google Chrome selection menu works, then the action should work too.

Peter, I am trying to iron out the wrinkles on a login with the keychain on the Chase Bank page. I tried using the above example and nothing appears to happen. It's not entering the info for the keychain entry.
Nothing is happening once it hits the 4th step. Any ideas? -John

The macro you show is not referencing the keychain at all.

As for the fourth step, it depends entirely on the web page you are trying to access, please provide a link to the page.

Hey John,

The Set Variable to Keychain Password action does NOT work with Internet Passwords – only Generic Passwords.

So if you want to use the action you’ll have to specifically create a password for it to use.

The simplest way to do that is to use Keyboard Maestro’s own Set Keychain Password to Text action.

An alternative that does work with Internet Passwords is the security command-line tool.

-Chris

1 Like

I am not quite sure I understand what you mean by “Generic” Passwords? What exactly is the difference between a Generic Password and an Internet Password?

Hey John,

Spend 50 hours researching, and I’ll bet you won’t discover exactly the difference.

Look in your Keychain with the Keychain Access.app, and see the Internet Password category.

Read the security man page and look at the various commands:

add-generic-password        Add a generic password item.
add-internet-password       Add an internet password item.
delete-generic-password     Delete a generic password item.
delete-internet-password    Delete an internet password item.
find-generic-password       Find a generic password item.
find-internet-password      Find an internet password item.

Play with the security command-line tool and dump various records Internet and Generic to compare…

Internet Password records will have some fields that Generic Passwords don’t (and perhaps vice-versa).

-Chris

After your last post I headed over to the terminal and was surprised to find how extensive the command list was. It’s a lot to digest.

A post was split to a new topic: Setting a Chrome Login from a Keychain Password?