#8282·zitadel

[Bug]: Errors.User.WebAuthN.BeginLoginFailed

Author: Pedro642001Created Jul 10, 2024Updated Sep 30, 2026
Labelsarea/authTo-be-closed

Preflight Checklist

  • I could not find a solution in the documentation, the existing issues or discussions
  • I have joined the ZITADEL chat

Environment

Self-hosted

Version

2.55.2

Database

PostgreSQL

Database Version

16

Describe the problem caused by this bug

We are developing a perfil screen, where the user can change their login settings. The user sets up their U2F normaly. But, when the user start login on application, they get an error.

image

To reproduce

  1. On Backend, we use this endpoint to get the public credential with lib @zitadel/node:
typescript
const authServiceClient = this.createAuthClientZitadel(accessToken);

const response = await authServiceClient.addMyAuthFactorU2F({});

return {
	publicKey: response.key?.publicKey.toString("base64url")!,
};
  1. On frontend, we use this fuctions to parse the credential
typescript
create(parseCreationOptionsFromJSON( JSON.parse(atob(publicKey ?? '')) as CredentialCreationOptionsJSON ))
  1. on frontend, we return data to backend with this params:
typescript
{
	publicKeyCredential: publicKeyCredential.toJSON(),
	tokenName
}
  1. The backend send this data to Zitadel, we try two possibilities. But, the fist, we recive an error, so, we used the second option as an alternative:
typescript

const authServiceClient = this.createAuthClientZitadel(accessToken);

await authServiceClient.verifyMyAuthFactorU2F({
	verification: {
		publicKeyCredential: Buffer.from(base64url.encode(publicKeyCredential)),
		tokenName,
	},
});
typescript
const authServiceClient = this.createUserClientZitadel(accessToken);

await authServiceClient.verifyU2FRegistration({
	publicKeyCredential,
	tokenName,
});
  1. After that, when the user starts the login on Zitadel screen, he receives the error bellow:

image

Lib backend:

  • "@zitadel/node": "^2.0.14"

Lib frontend:

  • "@github/webauthn-json": "2.1.1"

Screenshots

No response

Expected behavior

No response

Operating System

No response

Relevant Configuration

No response

Additional Context

No response