Hello, everyone,
I would like to persuade Auth0 to let me send the verification email myself. I have built a rule for this. This rule is enabled.
The rule itself is pretty much the same as described in the example. For testing I would like to make a request against pipedream. Code:
function (user, context, callback) {
const request = require('request');
user.user_metadata = user.user_metadata || {};
if (user.email_verified || user.user_metadata.verification_email_sent) {
return callback(null, user, context);
}
request.post({
url: 'https://******************.m.pipedream.net',
json: {
user: user,
context: context,
secretToken: configuration.MY_SECRET_TOKEN,
},
timeout: 5000
}, function(err, response, body){
if (err)
return callback(new Error(err));
// Email sent flag persisted in the user's profile.
user.user_metadata.verification_email_sent = true;
auth0.users.updateUserMetadata(user.user_id, user.user_metadata)
.then(function() {
callback(null, user, context);
})
.catch(function(err) {
callback(err);
});
return callback(null, user, context);
});
}
Additionally I have set the status slider in the email templates to Disabled, as described in the docs Customize Email Handling.
My code to create the user looks like this:
await this.authenticationClient.database.signUp({
connection: process.env.AUTH0_CONNECTION,
username: user.email,
email: user.email,
password: user.password,
email_verified: false
});
When I manually trigger the rule in the web interface, I can see the call in Pipedream. At the SignUp itself I don’t get a call.
Can anyone help me?