Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29923

Use sendgrid/other for forgot password in cognito

$
0
0

In case of user forgotting password I want to use third party email service like sendgrid instead of default cognito/ses solution. I know I can use cognito-triggers and lambda there to customize message. Problem is I can't get real reset code and getting placeholder instead.

Lambda:

exports.handler = async (event, context, callback) => {  await sendGridMail.send({    to: '...',    from: '...',    subject: '...'    text: `Your verification code is ${event.request.codeParameter}`  })  callback(null, 'email sent from aws lambda');}

Entire event value:

{"version": "1","region": "...","userPoolId": "...","userName": "...","callerContext": { ... }"triggerSource": "CustomMessage_ForgotPassword","request": {"userAttributes": {"sub": "...","email_verified": "true","cognito:user_status": "CONFIRMED","email": "..."        },"codeParameter": "{####}","linkParameter": "{##Click Here##}","usernameParameter": null    },"response": {"smsMessage": null,"emailMessage": null,"emailSubject": null    }}

In fact I just need to send through sendgrid event.request.codeParameter but there is no value there. Or maybe some other solution?


Viewing all articles
Browse latest Browse all 29923

Trending Articles