How to get Auth token for server to create new user

All of my endpoints work when a user is logged in, but I need my server to get an auth token in order to create a new user (/dbconnections/signup) endpoint. Obviously a user won’t be signed in until they are created, but my server is getting Unauthorized error. I’ve checked the documentation, and I can’t find anything. Also, I would like for this to work (just for right now, of course) for my http://localhost:3000 for testing purposes.

Could someone point me in the right direction of how to achieve this? Thank you!

Hey there @diaewad, you can leverage the api for authentication as per for the document below. If you test the API end point are you getting an unauthorized error? Can you DM me your tenant name so I can take a closer look at what may be going on when you get a minute? However, if I miss understood the intention please let me know and I am happy help in any way I can!

https://auth0.com/docs/api/authentication#introduction

As I said, I can authenticate users just fine. All authentication works when a user is logged in. I’m just trying to create authentication for my api itself when a user is not logged in, because I have built my own signup form, and I need to be able to create users. I was actually wrong initially when I said I get Unauthorized error. What happens when my api tries to hit the auth0 api, it sends the POST and gets a blank response, error, and body in return. So I don’t actually know if it’s because of authentication, since I get no error, but I can only assume that’s what it is.

Good news! I was able to figure it out. I needed to create a new API for the sole purpose of creating users. Then I can get an access token via client id and secret. Then I use that token to authorize a create user POST call. This is the page that helped me:

1 Like

Awesome work! Thank you for coming back and sharing the solution as well! Please keep us posted as things progress and if you have any questions in the future.

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