mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 00:29:40 +03:00
2FA via Email or WebAuthn fails on new app #1962
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fabicodes on GitHub (Jul 8, 2024).
Subject of the issue
The new native app has problems with the 2FA methods Email and WebAuthn (via Yubikey)
Deployment environment
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden:
Steps to reproduce
Try to log in using the new native app on Android. First, select WebAuthn where your Yubikey is enrolled. Firefox starts and says it cannot find a passkey for that site, select Security Key via NFC and follow the steps. Then it'll ask you in which app to continue (native or old) - choose native - it'll fail.
Then try the Email 2FA Method, it fails at creating the request to send it
Expected behaviour
2FA works
Actual behaviour
2FA fails
Troubleshooting data
@BlackDex commented on GitHub (Jul 8, 2024):
He is using the
testingtagged version.@BlackDex commented on GitHub (Jul 8, 2024):
So, i did some testing my self. And for me it seems to work just fine, except for the Email part.
But Both WebAuthn and Fido work without any issues, tested this with a YubiKey 5c both via NFC and USB.
Email currently breaks, so that is an issue.
Have you tried the latest Bitwarden Beta app?
Here you can see the last build available it this time: https://github.com/bitwarden/android/actions/runs/9842735019
At the bottom there is a
com.x8bit.bitwarden.beta.apkartifect which holds the last build android beta version.You might want to use that and see if that solves the issue regarding the YubiKey.
@fabicodes commented on GitHub (Jul 9, 2024):
I've previously just had the PlayStore Version installed! Thanks for this hint, unfortunately it still results in a failure
I'll check my YubiKey tomorrow via USB on a computer
@leo15dev commented on GitHub (Jul 9, 2024):
@BlackDex V.1.31.0 had the similar issue with 2FA via Authenticator app or Email in IOS native app.
[2024-07-09 08:10:54.346][error][ERROR] 2FA token not provided
[2024-07-09 08:10:54.346][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:11:19.594][request][INFO] POST /identity/connect/token
[2024-07-09 08:11:22.389][vaultwarden::api::push][ERROR] An error occurred while proceeding registration of a device: HTTP status client error (405 Method Not Allowed) for url (https://api.bitwarden.eu/push/register)
[2024-07-09 08:11:22.390][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:11:39.137][request][INFO] POST /identity/connect/token
[2024-07-09 08:11:39.592][vaultwarden::api::push][ERROR] An error occurred while proceeding registration of a device: HTTP status client error (405 Method Not Allowed) for url (https://api.bitwarden.eu/push/register)
[2024-07-09 08:11:39.592][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:12:13.036][request][INFO] POST /identity/connect/token
[2024-07-09 08:12:14.076][vaultwarden::api::push][ERROR] An error occurred while proceeding registration of a device: HTTP status client error (405 Method Not Allowed) for url (https://api.bitwarden.eu/push/register)
[2024-07-09 08:12:14.077][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:12:29.227][request][INFO] POST /api/two-factor/send-email-login
[2024-07-09 08:12:31.988][response][INFO] (send_email_login) POST /api/two-factor/send-email-login => 200 OK
[2024-07-09 08:12:50.855][request][INFO] POST /identity/connect/token
[2024-07-09 08:12:51.320][vaultwarden::api::push][ERROR] An error occurred while proceeding registration of a device: HTTP status client error (405 Method Not Allowed) for url (https://api.bitwarden.eu/push/register)
[2024-07-09 08:12:51.321][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:14:15.295][request][INFO] POST /identity/connect/token
[2024-07-09 08:14:15.332][vaultwarden::api::core::two_factor::email][ERROR] No token available
[2024-07-09 08:14:15.333][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-07-09 08:17:25.929][request][INFO] POST /identity/connect/token
[2024-07-09 08:17:25.980][vaultwarden::api::core::two_factor::email][ERROR] No token available
[2024-07-09 08:17:25.981][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
edited:
I found the solution in #4609
I think it should mention in the release note or add to the wiki, thanks.
@BlackDex commented on GitHub (Jul 9, 2024):
@leo15dev, that mail 2fa doesn't work on the new release via the native app isn't strange, it isn't fixed yet.
Changing the push notifications api shouldn't fix the issue, as those are not related in any way.
But mentioning the push api change in the changelog is probably a good thing to do.
@Gerardv514 commented on GitHub (Jul 11, 2024):
FYI I have the iOS beta app, I have Authenticator app, duo, and email setup as 2fa methods on VW v1.31. I am not even being prompted at all for any of those 2fa methods on the beta app, it logs right in. Unsure if this would be client side or server side.
@glmdev commented on GitHub (Oct 27, 2024):
Hi :) Long-time user here; appreciate all the hard work.
I'm still having this issue on the latest build (1.32.3) -- I cannot login with either TOTP MFA or FIDO2 WebAuthn in Firefox directly or in the Firefox extension (on Linux).
I'm able to do so in Chromium. After downgrading (back) to build 1.30.5 I'm able to login in Firefox, but obv this isn't a long-term fix.
The error I was getting was the same 400 error against
/identity/connect/token("Can't recover login challenge"). I did try fully clearing my browser cache on 1.32.3 to no avail.I'm running the
vaultwarden/serverDocker container in K8s. Are there any logs or additional info I could provide that might be helpful?@glmdev commented on GitHub (Oct 27, 2024):
Well this might have been user error. I realized that on neither 1.32.3 OR 1.30.5 would my vault data load even if I was able to log in (something about a "bad refresh token" error on the same endpoint). I suspect this was my fault for trying to downgrade.
I decided to just start fresh and re-import my vault data, so no harm done. I suppose I learned my lesson about tracking
vaultwarden/server:latestinstead of manually validating the upgrade.@BlackDex commented on GitHub (Oct 27, 2024):
Not sure if that is the case. And without any debugging data like what the server send, and what the browser reported, there is no way to know what was the issue or how we could fix it if something is wrong.
@glmdev commented on GitHub (Oct 27, 2024):
Here are redacted server logs with
LOG_LEVEL=traceandEXTENDED_LOGGING=true. I've also attached redacted info from the HTTP requests to thetokenendpoint both before and after I provide my MFA code.This is on the latest build against the broken vault -- I'm able to log in, but the vault data is empty. Like I mentioned, I got up and running again by restoring a clean backup.
websocket-request.txt
vaultwarden-failed-token-post-login.txt.txt
vaultwarden-failed-token-pre-login.txt
logs-from-vaultwarden-in-vaultwarden-7765fdc64b-k4z5h.log
One thing that stood out to me -- the refresh token being sent along is flagged as invalid by the server. Not sure how this is encoded, but I tried running it through
base64 --decodewhich said it was malformed.@BlackDex commented on GitHub (Oct 27, 2024):
The refresh token can be decoded via https://jwt.io.
Further, i would suggest to validate the date/time on your system. It might be out-of-sync.
There have been some Daylight Savings adjustments done last night, so it might be your server is still an hour off.
Check the
https://your.domain.tld/admin/diagnosticsif the date/time are still correct.@glmdev commented on GitHub (Oct 27, 2024):
Thanks for the suggestions. I put the refresh token in
jwt.io, and tried every algorithm but it said the token was not encoded correctly.For context, I've been doing this process in a new private browsing session each time.
/admin/diagnosticsgave me a 404 error, butexec-ing into the pod and runningdatemanually showed that the TZ is UTC and the time is correct.@BlackDex commented on GitHub (Oct 27, 2024):
You shouldn't have to select any algorithm. If it doesn't decode it right away, something has mangled the JWT very badly. Be sure to not base64 decode it your self btw.
It should start with
eyand somewhere down the line it should do that again. If not, then I wonder what you have as a token.You could try to stop Vaultwarden, delete the rsa files in the data directory, start Vaultwarden again and see what happens if you login again.
Also, if the diagnostic page gave a 404, then you probably have not yet enabled the admin interface.