Auth0 Home Blog Docs

Auth0 passwordless magic links - hooks not getting called


#1

I have a below requirement:

a) From the frontend user will enter a email. A magic link will be sent to that email ( this is done from our side and is working as expected)

b) Now when the user clicks the link and verifies the application we need a webhook which will create user record in our database.

c) For this we created a “POST registration” webhook so that we can pass the data to the RESTful api. but the api is not getting called when the user click on the mic link and verifies himself.

Below is the post registration webhook script:

module.exports = function (user, context, cb) { console.log(user); var request = require(‘request’); var options = { method: ‘POST’, url: ‘URLS’, headers: { ‘content-type’: ‘application/json’ }, body: user, json: true }; console.log(options); request(options, function (error, response, body) { if (error) cb(new Error(error)); console.log(body); cb(null, response); // assuming there’s a response variable });