Can't setup Yubikey OTP on bitwarden

So I setup the OTP in the Yubikey Manager software, used serial for the first and generated the second two fields. Then when I try to set it up on the bitwarden web vault it just says “Key1 is invalid” after it types in the code. How do I set this up such that it works?

Hi @hornedCapybara - welcome!

If you haven’t seen this guide already, you may find it helpful:
https://bitwarden.com/help/article/setup-two-step-login-yubikey/

I have seen that but it doesn’t help.

Hi again - if you have followed the guide to the letter, then I suspect there is something other than your setup that is causing your problem. For example, a common problem can be that the date and time on your device is out of sync with the server (although in your case, if you just setup Yubikey OTP, that seems unlikely).

Any additional diagnostic details you can provide would be helpful.

When I hit the button it is giving a different code each time, starting with the same string. All I did to set up the OTP was open yubikey manager, hit configure, use serial number for the first one, and generate the next two fields at random. Then I try to hit the button to put that code in the setup field and it says it’s invalid, while on the yubico test website it says the code is valid.

after you setup the OTP in the Yubikey Manager software, you must upload the value of Public ID, Private ID and Secret key to https://upload.yubico.com/. Then you can use your Yubico OTP in Bitwarden (or other services).

(Note: There is no way to retrieve the Public ID, Private ID, and Secret key that have been written to the YubiKey, so they need to be recorded manually at the time of generation.)

If you are using self-hosted Bitwarden, you will also need to obtain the Client ID and Secret key from https://upgrade.yubico.com/getapikey/, and then configure the obtained Client ID and Secret key into the environment variable file.