CLI version 2024.6.0 login with apikey fails
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:
We validate that we are logged in, by running the status command:
bw status
But it says that we are unauthenticated!
Expected Result
That we are authenticated
Actual Result
Not authenticated
Screenshots or Videos
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.
Hi @pjlammertyn,
Thank you for this report.
- Could you please clarify how you installed that Bitwarden CLI client?
- If you test this using the (bw-linux-2024.6.0.zip) release from here and run
./bw login --apikeyand then./bw status, what do you encounter?
Thank you,
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?
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.
⚠️ 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! 🙏
It would be great if the issue can be resolved rather than ignoring until it goes stale.