Auth0 Home Blog Docs

Add data into user_metadata in login script

Hi,
I would like to add some information into user_metadata inside the login script. (custom: use_mfa flag)
Like
callback(null, {
user_id: ‘manuel_test_1’,
email: ‘manual-test-1@test.com’,
user_metadata: {
use_mfa: true,
}
});

Is it possible or the login script can only call the callback with user_id and email?

Thanks

It’s possible and the syntax you’re using is acceptable as in it would result in a property use_mfa within user_metadata. Just have in mind that if you extend this to also return app_metadata then you’ll need to return it from the custom database script within a property named metadata instead of app_metadata as mentioned at (https://auth0.com/docs/connections/database/custom-db/templates#script-template-checklist).

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.