BW CLI login with 2FA code

Using BW CLI version 2023.5.0

When I enter the following to login to BitWarden using the CLI
bw login user password --method 1 --code 123456
I get an error: Two-step token is invalid. Try again.
If I enter:
bw login user password --method 1
And enter the 2FA code when prompted, the login succeeds.
???

@cliff, as per the documentation you should be using --method 0 (authenticator app).

I don’t really know why it works when you provide the code interactively, but at least now we know why it does not work when you provide it via command line argument.

@pwseo, Thank you for your prompt reply. Using --method 0 does indeed succeed.

The reason I used --method 1 was because if you type bw login --help, it gives as an example:
bw login [email protected] myPassword321 --method 1 --code 249213

Once again, thank you for your help.