doy / rbw

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

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

Closed TheNilesh closed 3 months ago

TheNilesh commented 4 months ago
$ sudo dpkg -i rbw_1.9.0_amd64.deb
Selecting previously unselected package rbw.
(Reading database ... 219884 files and directories currently installed.)
Preparing to unpack rbw_1.9.0_amd64.deb ...
Unpacking rbw (1.9.0) ...
Setting up rbw (1.9.0) ...
$ rbw --version
rbw 1.9.0
$ rbw purge
$ rbw register
$ rbw config show
{
  "email": "xxxx@gmail.com",
  "base_url": "https://api.bitwarden.com",
  "identity_url": "https://identity.bitwarden.com",
  "notifications_url": "https://notifications.bitwarden.com",
  "lock_timeout": 3600,
  "sync_interval": 3600,
  "pinentry": "pinentry",
  "client_cert_path": null
}
$ rbw register
$ rbw login
rbw login: failed to log in to bitwarden instance: failed to parse JSON: EOF while parsing a value at line 1 column 0

The official bw cli works as expected using the same client_secrets. I have enabled 2FA recently.

Pablo12345678901 commented 4 months ago

Dear [TheNilesh], I had the same issue.

I checked the base_url through wget and it returned ERROR 404. Same on a browser... So I tried to connect through a browser and noticed that the base_url was changed to "https://vault.bitwarden.com/".

I guess you found this solution since then but in case it can help for other users, I have written it.

TheNilesh commented 4 months ago
$ rbw config set base_url "https://vault.bitwarden.com"
$ rbw login      
rbw login: failed to log in to bitwarden instance: error making api request: error sending request for url (https://identity.bitwarden.com/connect/token): error trying to connect: dns error: failed to lookup address information: Try again: error trying to connect: dns error: failed to lookup address information: Try again: dns error: failed to lookup address information: Try again: failed to lookup address information: Try again
Pablo12345678901 commented 4 months ago

I am neither the project owner nor a developper of it but :

My configuration is the same as your except that as in the official documentation I have '/' at the end of each url :

{"email":"XXX@XXX", "base_url":"https://vault.bitwarden.com/", "identity_url":"https://identity.bitwarden.com/", "notifications_url":"https://notifications.bitwarden.com/", "lock_timeout":3600, "sync_interval":1800, "pinentry":"pinentry", "client_cert_path":null }

I tried to : wget https://identity.bitwarden.com/connect/token -> ERROR 400: Bad Request wget https://identity.bitwarden.com/connect/ -> ERROR 404: Not Found. wget https://identity.bitwarden.com/ -> ERROR 404: Not Found.

I would advice you to :

Else I don't want to investigate the code that is not mine to help further.

TheNilesh commented 3 months ago

@Pablo12345678901 Thanks! I retried rbw login without changing the config, today, and it worked. Maybe it was a temporary network/caching issue.

$ rbw config show
{
  "email": "xxxxx@gmail.com",
  "base_url": "https://vault.bitwarden.com",
  "identity_url": "https://identity.bitwarden.com",
  "notifications_url": "https://notifications.bitwarden.com",
  "lock_timeout": 3600,
  "sync_interval": 3600,
  "pinentry": "pinentry",
  "client_cert_path": null
}
TheNilesh commented 3 months ago

I'm closing this issue with the solution:

 $ rbw config set base_url "https://vault.bitwarden.com/"