How to pipe bitwarden cli with a command that require a password?

Hi,
I was wondering if it’s possible to pipe a command that prompts for a password (eg: connecting to a Mysql instance) with bitwarden cli so that I don’t have to open bitwarden extension, copy the password and paste it.

Thank you!

1 Like

I’e been trying to do this, managed to get something working for authentication to my work kerberos.

echo $(bw get password "Work IDP") | kinit username@domain

However for another case when I’m trying to authenticate to my work VPN I can’t get it to work:

echo $(bw get password "Work VPN") | \
  sudo /usr/sbin/openconnect <options> vpn.hostname --passwd-on-stdin

it just hangs as if it’s waiting for the password, I wonder if the sudo is interfering with the pipe?

Did any of you ever find a solution to this?

I didn’t. However work changed the VPN setup to something that didn’t require sudo so I stopped looking.