Errors with flow when trying to validate email address with OTP

Hi community.

I couldn’t find an existing topic on this, so hoping you can help.

I am trying to ensure that the user’s email address is validated before completing the login process, and to do that I am using the flow which will send an OTP to the user’s email address to validate using forms and flows in the post login trigger.

The trigger works ok, but the flow fails because it seems the user’s email address is not being passed into the flow.

I am using context.user.email as the field to pick up, and it works fine in test, but not in the actual login flow itself.

Does anyone have an idea what I may have misconfigured or otherwise need to change?

The trigger looks like this:

Blockquote
exports.onExecutePostLogin = async (event, api) => {
if(!event.user.email_verified) {
api.prompt.render(event.secrets.loginFormKey);
}
}

Blockquote

When checking the flow excecution log, it says the below, and the user object seems to be blank;

Blockquote
{
“code”: “ERR_INVALID_ACTION_PARAMS”,
“message”: “Calculated parameters do not satisfy the expected schema”,
“details”: {
“invalidParams”: [
{
“code”: “ERR_EMAIL_EXPECTED”,
“message”: “must match format "email"”,
“path”: “/from/email”
}
]
}
}

Blockquote

Blockquote
“context”: {
“user”: {
“user_id”: “███”,
“name”: “███”,
“nickname”: “███”,
“email”: “███”,
“email_verified”: “███”,
“picture”: “███”,
“user_metadata”: {},
“app_metadata”: {},
“created_at”: “███”,
“updated_at”: “███”,
“identities”: [
{
“user_id”: “███”,
“isSocial”: “███”,
“provider”: “███”,
“connection”: “███”
}
]
},

Blockquote

Appreciate any assistance you can provide!

Hi @pdettuk

Welcome to the Auth0 Community!

Thank you for posting your question, please verify if you set the Sender email (required) in the Flow responsible for sending OTP email. You can read more about that here →

Thanks
Dawid