Custom Signup Using Auth0 and send the auth0 user id in my database

Hi everyone,

I have a signup page built already on the front end. When Signup is clicked, I need to create a user using Auth0 api using POST. I am using React js and Node js. So can someone point me to the right directions/steps that I will have to follow to create Auth0 user and retrieve user id of that created account so that I can store the user_id in my database.

Thanks in advance.

If you have a back-end my recommendation would be to perform the creation of the user in Auth0 through the Management API (https://auth0.com/docs/api/management/v2#!/Users/post_users). This will imply that you need to get an access token to call the Management API and that can only be done securely from a back-end, however, it will give you additional flexibility in the process to create the user and also return the full user identifier in the response.

Alternatively, if the connection has public signups enabled you could use the endpoint (https://auth0.com/docs/api/authentication#signup) which would not require an access token, but the feature set would be more limited.

Thanks @jmangelo, So using Management API to create users via post method would return me a auth0 user_id in the response. So using this user_id, I can store the user_id in my database, and I can do a Custom Login right? Or does the login still directs me to Lock widget for authentication ?

Coz I am looking for a Custom Signup that retrieves the auth0 user_id and use that to Login into the application by Custom login.

Given that to complete the signup the end-user gives you the newly select plain text password then your system could attempt a login with that password immediately after the signup. However, there’s some considerations around this as although signups can be done in a relatively straightforward way from your own system, the recommended approach for login would be to use universal login flow.

However, the above means that the end-user would be redirected and as such they would have to input the password again. If your system is making use of cross-origin authentication (which is not recommended) then technically this would be feasible as after the signup you would just call login with the password provided at signup.