Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use "cli" as client id when logging in, fixes #182 #186

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

impact-merlinzerbe
Copy link
Contributor

the official bitwarden cli uses the following parameters when logging in (POST /connect/token):

scope=api offline_access
client_id=cli
deviceType=25
deviceIdentifier=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
deviceName=linux
grant_type=password
username=xxxxxxxxxxxxxxxxxxxxxxxxx
password=xxxxxxxxxxxxxxxxxxxxxxxxx

before this commit, rbw uses these parameters:

scope=api offline_access
client_id=desktop
deviceType=8
deviceIdentifier=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
deviceName=rbw
devicePushToken=
grant_type=password
username=xxxxxxxxxxxxxxxxxxxxxxxxx
password=xxxxxxxxxxxxxxxxxxxxxxxxx

although there are multiple differences, changing the client id from "desktop" to "cli" is sufficient to fix the issue.

the official bitwarden cli uses the following parameters when logging
in (POST /connect/token):

```
scope=api offline_access
client_id=cli
deviceType=25
deviceIdentifier=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
deviceName=linux
grant_type=password
username=xxxxxxxxxxxxxxxxxxxxxxxxx
password=xxxxxxxxxxxxxxxxxxxxxxxxx
```

before this commit, rbw uses these parameters:

```
scope=api offline_access
client_id=desktop
deviceType=8
deviceIdentifier=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
deviceName=rbw
devicePushToken=
grant_type=password
username=xxxxxxxxxxxxxxxxxxxxxxxxx
password=xxxxxxxxxxxxxxxxxxxxxxxxx
```

although there are multiple differences, changing the client id from
"desktop" to "cli" is sufficient to fix the issue.
@impact-merlinzerbe
Copy link
Contributor Author

I have also created a branch that shows how to export the tls keys from rbw to debug the network requests in wireshark, see https://github.com/impact-merlinmarek/rbw/tree/enable-sslkeylogfile

@doy doy merged commit ece4694 into doy:main Jun 19, 2024
8 checks passed
@doy
Copy link
Owner

doy commented Jun 19, 2024

thanks!

@dezeroku
Copy link
Contributor

As for the deviceType, we'll probably want to change that too sooner or later.
It seems that 8 describes Linux, while 25 is specifically for Linux CLI : bitwarden/server#3329
https://github.com/bitwarden/server/blob/main/src/Core/Enums/DeviceType.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants