Nik
04/08/2024, 10:50 AM"requiredSecondaryFactors": [
"totp"
]
When user removed the device via device/remove and has no devices linked - should the metada automatically be updated to remove the required 2nd factor?rp_st
04/08/2024, 10:52 AMNik
04/09/2024, 7:50 AMPlease initialise the account linking recipe and define shouldDoAutomaticAccountLinking to enable MFA
I have initialised accountlinking as per https://supertokens.com/docs/thirdpartypasswordless/common-customizations/account-linking/automatic-account-linking
I've set the automatic linking to be false in all scenarios currently.
Next up I am calling SignIn, retrieving the st-access-token and using that to call signinup/code again and this time I get
"message": "First factor sign in/up called for a non-first factor with an active session."
and I am cannot get any info on that.rp_st
04/09/2024, 7:54 AMrp_st
04/09/2024, 7:55 AMNik
04/09/2024, 7:55 AMNik
04/09/2024, 7:56 AMNik
04/09/2024, 7:57 AMrp_st
04/09/2024, 7:58 AMrp_st
04/09/2024, 7:58 AMrp_st
04/09/2024, 7:58 AMNik
04/09/2024, 7:59 AMrp_st
04/09/2024, 7:59 AMrp_st
04/09/2024, 7:59 AMNik
04/09/2024, 8:03 AMrp_st
04/09/2024, 8:03 AMrp_st
04/09/2024, 8:04 AMrp_st
04/09/2024, 8:04 AMNik
04/09/2024, 8:06 AMMultiFactorAuth.init(
{
firstFactors: ["emailpassword", "thirdparty"],
override: {
functions: (originalImplementation) => {
return {
...originalImplementation,
getMFARequirementsForAuth: async function (input) {
if ((await input.requiredSecondaryFactorsForUser).includes("totp")) {
// this means that the user has finished setting up a device from their settings page.
if (await shouldRequireTotpForTenant(input.tenantId)) {
return ["totp"]
}
}
// no totp required for input.user, with the input.tenant.
return []
}
}
}
}
}),
Hmm as I paste this, I have a strong suspicion additional set up is required hererp_st
04/09/2024, 8:06 AMrp_st
04/09/2024, 8:06 AMrp_st
04/09/2024, 8:07 AMNik
04/09/2024, 8:07 AMrp_st
04/09/2024, 8:07 AMrp_st
04/09/2024, 8:07 AMNik
04/09/2024, 8:07 AMrp_st
04/09/2024, 8:08 AMgetMFARequirementsForAuth
function, you need to return ["totp", "otp-email", "otp-phone"]rp_st
04/09/2024, 8:09 AMNik
04/09/2024, 8:09 AMrp_st
04/09/2024, 8:11 AMotp-email
or otp-phone
configured.
Hence this errorNik
04/09/2024, 10:31 AMreturn ["otp-email"]
in all cases however still getting the message of "First factor sign in/up called for a non-first factor with an active session."
rp_st
04/09/2024, 10:32 AMrp_st
04/09/2024, 10:32 AMNik
04/09/2024, 10:34 AMrp_st
04/09/2024, 10:36 AMrp_st
04/09/2024, 10:36 AMNik
04/09/2024, 10:39 AMcom.supertokens {t: "2024-04-09T10:34:12.752Z", message: "isValidFirstFactor tenantconfig enables: emailPassword,passwordless", file: "C:\_iqusdev\dev.supertokens.api\node_modules\supertokens-node\lib\build\recipe\multitenancy\utils.js:73:14" sdkVer: "17.0.0"} +0ms
which kinda explains the error, I suppose, however
MultiFactorAuth.init({
firstFactors: ["emailpassword", "thirdparty"],
and there is nowhere in code that i set first factor as paswordless. Also if i remove the multifactorAuth.init alltogether, then the issue goes awayrp_st
04/09/2024, 10:40 AMrp_st
04/09/2024, 10:41 AMrp_st
04/09/2024, 10:44 AMNik
04/09/2024, 10:45 AMcom.supertokens {t: "2024-04-09T10:43:55.260Z", message: "isValidFirstFactor tenantconfig enables: emailPassword,passwordless", file: "C:\_iqusdev\dev.supertokens.api\node_modules\supertokens-node\lib\build\recipe\multitenancy\utils.js:73:14" sdkVer: "17.0.0"} +0ms
rp_st
04/09/2024, 10:45 AMrp_st
04/09/2024, 10:47 AMrp_st
04/09/2024, 11:04 AMNik
04/09/2024, 11:16 AMrp_st
04/09/2024, 11:16 AMporcellus
04/09/2024, 11:19 AMporcellus
04/09/2024, 11:20 AMNik
04/09/2024, 11:22 AMporcellus
04/09/2024, 11:25 AM[{ oneOf: ["totp", "otp-phone", "otp-email"]}]
for mfa requirementsrp_st
04/09/2024, 2:10 PMNik
04/09/2024, 2:54 PMrp_st
04/09/2024, 3:08 PM