I found this question which is very helpful. Unfortunately they get closed so I can’t simply continue the same discussion.
I don’t suppose there is any way to implement this if I am using a different app registration for each tenant in a multitenant environment? The domain, client id, secret and connection are hard coded here. Is there any avenue for making these dynamic? The context seems to have a reference to the connection id. Is there away to get the other info?
Unfortunately, the client data isn’t available to the post-user registration hook, but instead only the following:
/**
@param {object} user - user being created
@param {string} user.id - user's ID (user GUID without "auth0|" database prefix)
@param {string} user.tenant - Auth0 tenant name
@param {string} user.username - user's username
@param {string} user.email - user's email
@param {boolean} user.emailVerified - indicates whether email is verified
@param {string} user.phoneNumber - user's phone number
@param {boolean} user.phoneNumberVerified - indicates whether phone number is verified
@param {object} user.user_metadata - user's user metadata
@param {object} user.app_metadata - user's application metadata
@param {object} context - Auth0 context info, such as connection
@param {string} context.requestLanguage - language of the application agent
@param {object} context.connection - connection info
@param {object} context.connection.id - connection ID
@param {object} context.connection.name - connection name
@param {object} context.connection.tenant - connection tenant
@param {object} context.webtask - Hook (webtask) context
@param {function} cb - function (error, response)
*/
What you could do is use the Management API’s POST/api/v2/tickets/password-change endpoint and your own email provider to send the password reset link in the email instead (following the guide: Send Email Invitations for Application Signup). Unfortunately, there isn’t a way to determine the client at that point in the auth flow otherwise.