Access management API from hook

Related to this post: New user via API - set password flow - #11 by adeliab I’m looking into using Post User Registation Hooks to get password change ticket and call sendgrid to send an email.

Looking at this post Accessing Auth0 Management API in rules vs hooks it seems that it is not possible to access the management API from Hooks. Is this correct?

In this example: Send Email Invitations for Application Signup where does the process to get the change password ticket and send email take place? It’s unclear


Hi @adeliab,

It is possible to use the management API in hooks. That post is just saying that the same tools aren’t available to set up the call to the management API (it just takes a bit more code to get the access token).

With that said, you should avoid making a call to update a user (or send a ticket in this case) because a user may not exist when a post registration hook/action is executed.

This would need to be handled by your backend.

Thanks @dan.woda . According to the documentation this hook is triggered after the user is added to the database. I understand that the hook will run async to the transaction so an update is not recommended. But creating a password change ticket shouldn’t affect the user right? It’s only creating a link?

I think it is possible that you would run into a scenario where the user does not yet exist and you return an Error: 404 User not found.

One of our engineers @stephanie.chamblee just wrote a great FAQ about it:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.