bitwarden / cli

The command line vault (Windows, macOS, & Linux).
https://bitwarden.com
GNU General Public License v3.0
1.62k stars 174 forks source link

bw item create error Cannot refresh token, no refresh token or api keys are stored #512

Closed Bibelo closed 2 years ago

Bibelo commented 2 years ago

Although I appreciate Bitwarden and the work that has been done over the past years, I cannot keep using the cli, as it has become unreliable, both technically and on a structural level.

Not only the previous unresolved bugs (mine or others) that have not been adressed continue to cripple the cli, but I feel a persistence in that trend.

The structural problems started long ago, with illogical commands (adding an item puts it... nowhere? bw login does not actually log you?) and keep going.

The latest being that after updating to 1.22, the bw create item not only does not work anymore, but gives me yet another cryptic message. It might be my fault misapplying the doc (even though that command worked perfectly before) but it seems the error message is documented nowhere anyway:

Cannot refresh token, no refresh token or api keys are stored

(even though I duly applied the whole client_id/client_secret monkey-business, bw status shows unlocked, bw list items work, etc.)

I have no choice but getting rid of the cli. I've wasted so much time trying to make things work since the big August 2021 disaster (ie update), but I face another wall that's very discouraging and I've got other fish to fry. That means just unrooting it from my scripts, and that will take hours. But my scripts don't work anymore anyways.

Edit: typos

cscharf commented 2 years ago

Hi @Bibelo ,

Thank you for raising this issue that you're facing. I'm updating the title of the issue to reflect the issue you're experiencing so others may benefit from the discussion and one of our engineering team members will be adding some troubleshooting steps here shortly to see if we can get this resolved quickly or at least get to the root cause.

MGibson1 commented 2 years ago

Cannot refresh token, no refresh token or api keys are stored Is referring to an authentication token. Depending on your auth method, you are either given a refresh token to re-up your authentication token once it expires or you use your api key to re-authenticate. This happens automatically.

It seems that for some reason or another the refresh method has been lost. Logging out and back in again should populate storage with a new way to refresh the auth token and get you back on track.

As for the message being unclear, It shouldn't be hit by users in a working system and so was not given the same kind of context it might otherwise be afforded. Perhaps a wrapper around our authentication guard to provide context 🤔. I don't want to muddle this Issue with discussion on that, but I'd be happy to accept a PR that attempted to provide more context around authentication issues, embellishing on error messages with the context that it occurred during auth checks.

MGibson1 commented 2 years ago

Hi @Bibelo, I'm going to assume the above advice fixed your token problem and close this issue.

If it did not, please reopen.