diff --git a/lib/build/recipe/webauthn/recipeImplementation.js b/lib/build/recipe/webauthn/recipeImplementation.js index 3d597f5f5..e6e586dcf 100644 --- a/lib/build/recipe/webauthn/recipeImplementation.js +++ b/lib/build/recipe/webauthn/recipeImplementation.js @@ -68,15 +68,16 @@ function getRecipeInterface(querier, getWebauthnConfig) { } const user = result.user; // todo this might be wrong but will have to figure out - what happens when there are multiple webauthn login methods ? - const email = + const parsedEmail = (_b = user.loginMethods.find((lm) => lm.recipeId === "webauthn")) === null || _b === void 0 ? void 0 : _b.email; - if (!email) { + if (!parsedEmail) { return { status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR", }; } + email = parsedEmail; } if (!email) { return { diff --git a/lib/ts/recipe/webauthn/recipeImplementation.ts b/lib/ts/recipe/webauthn/recipeImplementation.ts index 1aebd319a..005fdaac2 100644 --- a/lib/ts/recipe/webauthn/recipeImplementation.ts +++ b/lib/ts/recipe/webauthn/recipeImplementation.ts @@ -45,12 +45,13 @@ export default function getRecipeInterface( const user = result.user as User; // todo this might be wrong but will have to figure out - what happens when there are multiple webauthn login methods ? - const email = user.loginMethods.find((lm) => lm.recipeId === "webauthn")?.email; - if (!email) { + const parsedEmail = user.loginMethods.find((lm) => lm.recipeId === "webauthn")?.email; + if (!parsedEmail) { return { status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR", }; } + email = parsedEmail; } if (!email) {