Add a --force option to CLI login

CLI Login Force Refresh

  • Add a --force option to CLI login that will refresh credentials even if not expired.

Background

We explicitly close our vault login sessions in our CI pipeline.

During one of our CI pipelines the run did not complete successfully after we logged in to BitWarden CLI due to an error and the pipeline stops and finishes at the error. This meant we were left with a logged in / open vault session.

On the next run, due to this logged in session, we received the following error:

$ bw login --apikey
You are logged in!
To unlock your vault, use the `unlock` command.

This meant we needed to log in manually and run bw logout to allow our pipelines to continue running.

Feature function

Adding a --force option to the CLI login command will make it easier for CI pipelines to interact with Bitwarden CLI if there is a session already logged in.

This option is already available in a number of other CLI apps and it would be a nice addition here too.