doy / rbw

unofficial bitwarden cli
https://git.tozt.net/rbw
Other
649 stars 87 forks source link

failed to parse json #2

Closed bashfulrobot closed 3 years ago

bashfulrobot commented 4 years ago

Hello there,

I just configured the client using the configure command.

When attempting to login (prompted for my master password), I receive:

❯ rbw login
rbw login: failed to log in to bitwarden instance: failed to parse JSON: .: missing field `ErrorModel` at line 1 column 126: missing field `ErrorModel` at line 1 column 126

So I had a look around my system for this son file and found it at ~/.config/rbw/config.json

When looking in there, I had found:

{
    "email": "xxxxx@xxxxxxxxxx.com",
    "base_url": null,
    "identity_url": null,
    "lock_timeout": 3600
}

From the docs, I can gather that the URLs are ok to be null and will default to the BW servers.

System

RBW Version

❯ rbw --version
rbw 0.3.5

OS

❯ cat /etc/lsb-release
───────┬──────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/lsb-release
───────┼──────────────────────────────────────────────────────────────────────────────────────────
   1   │ DISTRIB_ID=Ubuntu
   2   │ DISTRIB_RELEASE=20.04
   3   │ DISTRIB_CODENAME=focal
   4   │ DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"
───────┴──────────────────────────────────────────────────────────────────────────────────────────

Any suggestions?

doy commented 4 years ago

are you using two-step login, by any chance? (and if so, which type are you using?) i don't have that implemented yet, but i'll try to get to it soon.

if that's not the issue, let me know and i'll dig further.

bashfulrobot commented 4 years ago

I did not even think of that. Yeah I am. The one I use is Google Authenticator based.

doy commented 4 years ago

i've added authenticator-based two-step login support in version 0.4.0 - let me know if it works for you!

bashfulrobot commented 4 years ago

Well, I have the prompt for 2fa, however, after entering the token I am faced with:

❯ rbw login
rbw login: failed to log in to bitwarden instance: invalid cipherstring

Thank You.

doy commented 4 years ago

hmmm, interesting. this one is a bit difficult to track down without an actual copy of your vault to poke at. can you try again with version 0.4.1? i've added some more logging that might at least give me a place to start looking.

out of curiosity, what clients are you currently using? also, how long have you been using bitwarden?

bashfulrobot commented 4 years ago

It is a google authenticator using the authy client.

The interesting thing - bitwarden registers the login. I received my email stating that I had a new login from a new device. I have been using BW for years.

I'll try again with the new version.

bashfulrobot commented 4 years ago

latest version & error:

❯ rbw login
rbw login: failed to log in to bitwarden instance: unimplemented cipherstring type: 0
❯ rbw --version
rbw 0.4.1
doy commented 4 years ago

ah, yeah, i only currently have support for the cryptographic algorithms that the current bitwarden clients use, but it looks like you still have some entries encrypted with an older version. the code for this should be fairly straightforward, but it's a bit tricky for me to fix because i'm not really sure how to generate test entries using the older format (to make sure i'm implementing the right thing). i'm open to pull requests for this, otherwise i'll see if i can dig up some old bitwarden clients to test this with at some point.

the other workaround here is that i'm fairly sure that if you export your vault and then reimport it, it should start working, although i know that's pretty annoying.

bashfulrobot commented 4 years ago

OK - I just exported my entire vault. Purged it and reported back into Bitwarden via the web interface.

I am still getting:

rbw login: failed to log in to bitwarden instance: invalid cipherstring

So that did not seem to help.

doy commented 3 years ago

based on https://github.com/doy/rbw/issues/40#issuecomment-787536599 it looks like rotating your encryption key is the thing that you actually need to do, since just deleting and recreating the vault with the same account won't actually change the encryption method.

i'm going to close this out for now, but feel free to reopen or file another ticket if this issue persists.