Bitwarden_rs: Cannot create API Key - An unexpected error has occurred - 404 Not Found

Created on 3 Dec 2020  路  11Comments  路  Source: dani-garcia/bitwarden_rs

Subject of the issue

I cannot create API key from Web GUI (selfhosted) "An unexpected error has occurred"

Your environment

LXC Container running BitwardenRS build from source
WEB UI is running without HTTPS, only HTTP
HAProxy on another machine doing HTTPS (Mapping 443 -> 80)
Port 3012 is also accessible

Server Installed: 1.17.0
Web Installed: 2.17.0

ufw temporarily disabled

Steps to reproduce

I click on generate API Key in the Web GUI and get "An unexpected error has occurred" message.

Syslog:

Dec 3 07:42:28 bitwardenRS bitwarden_rs[6248]: [2020-12-03 07:42:28.904][request][INFO] GET /api/accounts/profile
Dec 3 07:42:28 bitwardenRS bitwarden_rs[6248]: [2020-12-03 07:42:28.905][response][INFO] GET /api/accounts/profile (profile) => 200 OK
Dec 3 07:42:36 bitwardenRS bitwarden_rs[6248]: [2020-12-03 07:42:36.370][request][INFO] POST /api/accounts/api-key
Dec 3 07:42:36 bitwardenRS bitwarden_rs[6248]: [2020-12-03 07:42:36.370][response][INFO] 404 Not Found

Conclusion:

It looks like whatever should provide /api/accounts/api-key is not there...
Everything else is up and working. Having multiple organisations and some users accessing them. All good.

better for forum

Most helpful comment

If you are referring to the apikey for usage with the bw cli for example, that is not supported (yet). And thus hidden, and thus generates a 404.

All 11 comments

May i ask which version of the web-vault you are using?
Did you build it your self? And if so did you use npm run dist? If not, you probably have the wrong vault version for bitwarden_rs.

See: https://github.com/dani-garcia/bitwarden_rs/wiki/Building-binary#install-the-web-vault
On how to build the web-vault your self.

Hi,

I checked the admin panel:

Server Installed Ok
1.17.0
Server Latest
1.17.0
Web Installed Update
2.17.0
Web Latest
2.16.1

I think this is the problem. I try another version and report back.

I reinstalled everything but this time only up to version 2.16.1
I also applied the web vault patch 2.16.1.

Server Installed Ok
1.17.0
Server Latest
1.17.0
Web Installed Ok
2.16.1
Web Latest
2.16.1

Now the funny thing is I do not even see the option to generate an API Key anymore from within the web GUI. The section is just gone. Not there anymore. Do I have to enable this somehow?

If you are referring to the apikey for usage with the bw cli for example, that is not supported (yet). And thus hidden, and thus generates a 404.

THIS explains everything! Alright, Thank you! Is that common knowledge or somewhere written?

Last question: Is there another way to automate/script export (to .csv) at the moment? I know that I can export the database but that is not what I am looking for.

The recent v2.17.1 release of the web vault properly hides the API key section.

Alright no option to export to csv at the moment?

@aramaki87, you can export the vault via the tools menu when logged-in. Or use the cli https://github.com/bitwarden/cli

I Will close this issue and make a note of this in #246 that we could try and add this feature.

Thank you for your reply. However...

In order to use the cli I have to create an API key. The API key is entered in the cli to get access. This is not possible at the moment. As I tried to explain in this topic.
No feature request required. Just add the generate key feature again to let people create API keys again to enter them in the cli to get access to the cli features.

Read the docs at https://bitwarden.com/help/article/cli/#logging-in. The traditional login method is using your email address. API key login is a very new method that requires additional code in bitwarden_rs to generate API keys, which as we explained, is not currently implemented.

Was this page helpful?
0 / 5 - 0 ratings