clients icon indicating copy to clipboard operation
clients copied to clipboard

CLI version 2024.6.0 login with apikey fails

Open pjlammertyn opened this issue 1 year ago • 2 comments

Steps To Reproduce

export BW_CLIENTID="?????" # replace with your client id
export BW_CLIENTSECRET="??????" # replace with your client secret

bw login --apikey

The command responds, that we are succesfully logged in:

image

We validate that we are logged in, by running the status command:

bw status

But it says that we are unauthenticated!

Screenshot 2024-06-16 07 50 18

Expected Result

That we are authenticated

Actual Result

Not authenticated

Screenshots or Videos

image

Screenshot 2024-06-16 07 50 18

Additional Context

No response

Operating System

Linux

Operating System Version

debian 12

Shell

Bash

Build Version

2024.6.0

Issue Tracking Info

  • [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.

pjlammertyn avatar Jun 16 '24 05:06 pjlammertyn

Hi @pjlammertyn,

Thank you for this report.

  1. Could you please clarify how you installed that Bitwarden CLI client?
  2. If you test this using the (bw-linux-2024.6.0.zip) release from here and run ./bw login --apikey and then ./bw status, what do you encounter?

Thank you,

SergeantConfused avatar Jun 18 '24 11:06 SergeantConfused

I have the same issue. Bitwarden CLI ran as a docker, docker file is:

FROM ubuntu:focal

WORKDIR /usr/local/bin

ARG VERSION
ENV BW_SERVER=https://api.bitwarden.com
ENV BW_API_HOSTNAME=localhost
ENV BW_API_PORT=8087
ENV BW_CLIENTID=<YOUR_CLIENT_ID>
ENV BW_CLIENTSECRET=<YOUR_CLIENT_SECRET>

EXPOSE $BW_API_PORT

RUN apt-get update && apt-get install -y curl unzip libsecret-1-0 && \
    curl -LO "https://github.com/bitwarden/clients/releases/download/cli-v${VERSION}/bw-linux-${VERSION}.zip" && \
    unzip *.zip && chmod +x ./bw && \
    rm *.zip

ENTRYPOINT ["/bin/sh", "-c"]
CMD ["bw config server $BW_SERVER && bw login --apikey && bw serve --port $BW_API_PORT --hostname $BW_API_HOSTNAME"]

It will work fine for a full day then I start getting the unauthenticated error and need to restart the docker to have it authenticating again. I know it's not supported but to mention it here to help resolving the issue I'm using the unofficial vaultwarden server. @pjlammertyn are you on the same setup as mine?

DonSYS91 avatar Jul 01 '24 09:07 DonSYS91

This also happens with 2024.10.0. I have found that you need to remove the existing data.json file in order for this to work again. This should not be the case. I also discovered that the api session will lock the vault after 1 hour regardless of the timeout set on the server. This is when the logout and log back in would either have status of unauthenticated OR will log back in and create BW_SESSSION but vault will still be locked.

jonjohnston avatar Oct 25 '24 17:10 jonjohnston

⚠️ Stale Issue Notice

This issue has been automatically marked as stale due to inactivity. It will be closed in 2 weeks (October 15, 2025) if no further activity occurs.

If this issue is still relevant and you would like to keep it open, please:

  • Comment on this issue to show continued interest
  • Provide any additional information or updates
  • Confirm that the issue still exists in the latest version

Thank you for your contribution to this project! 🙏

closebot-bw avatar Oct 01 '25 18:10 closebot-bw

It would be great if the issue can be resolved rather than ignoring until it goes stale.

jonjohnston avatar Oct 01 '25 18:10 jonjohnston