fix(auth): validate WebAuthn rp.id against current host
Add ensureValidRpId helper to validate and correct rp.id for WebAuthn operations, preventing authentication failures when the configured rp.id doesn't match the current hostname. Also add OAuthProvider type and fix type casting in LoginPage.
This commit is contained in:
@@ -218,7 +218,7 @@ export default function LoginPage() {
|
||||
|
||||
try {
|
||||
// Step 1: Get login options from server
|
||||
const options = await api.webauthn.beginLogin(emailToUse) as WebAuthnLoginOptions;
|
||||
const options = await api.webauthn.beginLogin(emailToUse) as unknown as WebAuthnLoginOptions;
|
||||
|
||||
// Step 2: Create assertion using browser WebAuthn API
|
||||
const assertion = await createLoginAssertion(options);
|
||||
@@ -286,7 +286,7 @@ export default function LoginPage() {
|
||||
|
||||
try {
|
||||
// Step 1: Get login options from server
|
||||
const options = await api.webauthn.beginLogin(email) as WebAuthnLoginOptions;
|
||||
const options = await api.webauthn.beginLogin(email) as unknown as WebAuthnLoginOptions;
|
||||
|
||||
// Step 2: Create assertion using browser WebAuthn API
|
||||
const assertion = await createLoginAssertion(options);
|
||||
|
||||
Reference in New Issue
Block a user