bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
8.76k stars 1.15k forks source link

CLI version 2024.6.0 login with apikey fails #9677

Open pjlammertyn opened 1 month ago

pjlammertyn commented 1 month ago

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

SergeantConfused commented 1 month ago

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,

DonSYS91 commented 2 weeks ago

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?