doy / rbw

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

Can't use port in config.json #68

Open bitounu opened 2 years ago

bitounu commented 2 years ago

My bitwarden instance is accessible with URL with Port, similar to this: https://192.168.0.1:1234. Both base_url and identity_url contain such URL so I get error like this:

"failed to log in to bitwarden instance: failed to parse JSON: .: expected value at line 2 column 13: expected value at line 2 column 13"

This is of course because of a colon separating Port from IP. I tried to escape this colons with backslash but to no avail.

How to reproduce? put following string into your config.json: {"email":"john@doe.org","base_url":"https://192.168.0.1:1234","identity_url":"https://192.168.0.1:1234","lock_timeout":3600,"pinentry":"pinentry"}

rjc commented 2 years ago

Providing a port number isn't the issue here - even putting the defaults: https://api.bitwarden.com/ and https://identity.bitwarden.com/ for base_url: and identity_url: respectively, won't work - it'll produce the same error:

rbw code: failed to log in to bitwarden instance: failed to parse JSON: .: EOF while parsing a value at line 1 column 0: EOF while parsing a value at line 1 column 0

Not specyfying a scheme, won't work either:

rbw code: failed to parse base url: relative URL without a base

How are people using rbw with their own server instances?

doy commented 2 years ago

these actually look like two separate issues - the first one is trying to parse data but failing because it is invalid, and the second is not receiving any data at all to parse. are you editing your config.json by hand, or are you using rbw config set? ~the only problem i see when i try this is that it looks like raw ip addresses don't work currently (giving an entirely different error like rbw login: failed to log in to bitwarden instance: error making api request: error sending request for url (https://192.168.0.1:7777/api/accounts/prelogin): error trying to connect: invalid dnsname: error trying to connect: invalid dnsname: invalid dnsname)~ [edit: this is just because the tls cert doesn't validate when i use the ip address directly], but i am able to use something like https://example.com:7777 as my url without any problems.

rjc commented 2 years ago

Not sure about the OP but I've used both rbw config set and changed the values by hand - both generate the same parse error. More importantly, as mentioned above, even setting bitwarden.com default values generates the parse error.