Sync User MFA on login - Custom Database Connection

Hello,

We are trying to import/migrate Users from a DataBase to Auth0 using Enterprise Custom Database Connection.
We have also enabled Sync user profile attributes at each login

Options tried so far:

  • We have written a custom login script that is run at each login as suggested in this community post

Issue 1. unable to set multifactor: [“guardian”]

  • This property is not getting updated in User Profile - Raw Json, It is always set as empty multifactor: []

Issue 2. Also tried setting ‘guardian_authenticators’. This property is also not updated in User Profile Section - Raw Json

"guardian_authenticators": [
        {
            "id": "totp|dev_wwwhhw",
            "type": "totp",
            "confirmed": true,
            "created_at": "2023-06-05T13:00:33.000Z",
            "last_auth_at": "2023-06-05T13:02:47.000Z"
        }
       //{
       //     "type": "totp",
       //     "name": "OTP Application",
       //     "totp_secret": "BQBJCHSUSHDW"
       //   }
    ]

Issue 3. Tried setting mfa_factors, altough it is updated in User Profile Section - Raw Json, setting mfa_factors is not sufficient as user is never prompted to complete mfa.

  • i.e. This property is not reflected on Multi-Factor Authentication Section on Users’ page
 "mfa_factors": [
        {
            "totp": {
                "secret": "BQBJCHSUSHDW"
            }
        }
    ]

Also attaching Database Action script for login in nodejs
custom-login.js.txt (2.6 KB)

2 Likes

I am also facing the same issue. Does anyone has any update on this??

Hey dparakh-c,
Were you able to accomplish this task. We are actually trying to do something which has the similar functionality.

Hey sarathmahamkali,

Is everything alright?
I’m also working on a similar task, were you able to solve it in any way?

Is there any update from anyone?

ANSWER to my case:

Returning mfa_factors in DB Action Scripts to enroll users with MFA factors works only when the “Import Users to Auth0” option is enabled.