TsgcWSAPIServer_WebAuthnEvents › OnWebAuthnRegistrationError

OnWebAuthnRegistrationError Event

Fires when /register/verify rejects the attestation; exposes the failing request and the textual reason so the application can log or alert on it.

Syntax

property OnWebAuthnRegistrationError: TsgcWebAuthnOnRegistrationError;
// TsgcWebAuthnOnRegistrationError = procedure(Sender: TObject; const aRequest: TsgcWebAuthn_RegistrationVerify_Request; const aRegistration: TsgcWebAuthn_Registration; const aError: string) of object

Default Value

Remarks

Raised when attestation verification fails for any reason — invalid signature, unknown attestation format, challenge mismatch, origin mismatch, AAGUID rejected by OnWebAuthnRegistrationValidateCertificate, duplicate credential id detected by OnWebAuthnRegistrationValidateCredentialId, etc. aRequest carries the client payload, aRegistration the user context and aError a human-readable description. Use it to write audit records or to surface a localised error to the client.

Example

procedure TForm1.sgcWSAPIServer_WebAuthn1WebAuthnRegistrationError(Sender: TObject;
  const aRequest: TsgcWebAuthn_RegistrationVerify_Request;
  const aRegistration: TsgcWebAuthn_Registration; const aError: string);
begin
  Memo1.Lines.Add('Registration failed for ' + aRegistration.User.Name + ': ' + aError);
end;

Back to Events