Auth0 Home Blog Docs

Authorize hook to request my api within auth0

Post registration hook

I want to add the user created inside auth0 to my very own application. To do this i wanted to use the post registration hook, because that would make sense i think.

But whenever i try to add the user to my api i get a 401…
then i read i had to authenticate the hook like every other normal application. But in doing so i get so many exceptions from everywhere that i was hoping someone has done this before and was willing to help me achieve this.

Hi @jobse.ricardo,

You should be able to register the hook as an application and use a client credentials grant to create the user in your api. I don’t have an exact example, but it would essentially look like this:

Where the server is the hook and the API is your user API.

Hope this helps!

Thanks,
Dan

1 Like

Thanx alot! this completely solved it for me, i was using the client secret and id from my angular web app, but that did not work :confused:

For those of you following up on this thread, don’t forget to JSON.parse() the output so you can use the access_token provided by the response :wink:

1 Like

Glad that worked for you and thanks for the follow up!