# Creating user on our app and log user in Auth0 automatically

**URL:** <https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [January 24, 2024, 7:56pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618 "2024-01-24T19:56:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![malanciault](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/malanciault/32/51306_2.png) [@malanciault](https://community.auth0.com/u/malanciault)\
**Post date:** [January 24, 2024, 7:56pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/1 "2024-01-24T19:56:37Z")

</div>

Hi everyone!

We would like to use Auth0 with our multi-tenants SaaS product. Each of our Tenant will be an Auth0 Organization.

We have created a custom database connection linking to our own database. This is where our current users are.

We have managed to have users from Tenant X login using the Universal Login Page for Auth0 Organization X:

 ![Markup 2024-01-24 at 14.43.04](https://global.discourse-cdn.com/auth0/original/3X/d/7/d70f3e991462f468b7ec9259ccc589904b8929aa.png)

However, we have not been able to activate the Signup link for an Organization:

 ![Markup 2024-01-24 at 14.55.14](https://global.discourse-cdn.com/auth0/original/3X/2/b/2b4d7d7913e5ce5af261f92791b4aa908861873e.png)

After some research, it seems that this is not supported by Auth0.

The workaround we are investigating is the following:

1- We will manage the user registration

2- Once user is registered, we will create a user in Auth0 using Auth0 Management API

But then, we don’t want the user to have to login in Auth0 after filling up the registration form.

Is there a way we could create a session for this user on Auth0 via the API, thus avoiding the user to have to login again after having registered ?

Thanks for your help !

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 24, 2024, 9:30pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/3 "2024-01-24T21:30:58Z")

</div>

Hi @malanciault,

That’s correct. When users sign up on your application, they are automatically logged in. This is by design and unfortunately cannot be avoided.

As a workaround, you can create a custom user registration page where you call the [Authentication API’s Signup endpoint](https://auth0.com/docs/api/authentication#signup). This will create the user but not automatically log in. Using the Authentication API avoids an additional call for getting an access token to call the Management API.

If you need to perform additional Management API calls, it could be worth going that route with the [Management API’s Create a user endpoint](https://auth0.com/docs/api/management/v2/users/post-users).

Let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![malanciault](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/malanciault/32/51306_2.png) [@malanciault](https://community.auth0.com/u/malanciault)\
**Post date:** [January 24, 2024, 10:09pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/4 "2024-01-24T22:09:21Z")

</div>

Thanks for the answer Ruben. However, maybe I’m reading it wrong, but it’s not exactly what we want to do.

User will signup on a custom page on our SaaS. Then, what would be the best way for us to create the user in Auth0 and have the user already logged in in Auth0 without him needing to input email and password again in Auth0 login form?

Thanks for the help !

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 25, 2024, 6:44pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/5 "2024-01-25T18:44:11Z")

</div>

Hi @malanciault,

Thanks for the clarification.

It looks like we have a similar question asked in the Community that’s answered in [this thread](https://community.auth0.com/t/automatic-login-after-creating-auth0-user/21362).

Essentially, since you will have the user’s email and password after creating the user, what you need to do is obtain an access token and send it to the client.

Please refer to the thread above and let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![malanciault](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/malanciault/32/51306_2.png) [@malanciault](https://community.auth0.com/u/malanciault)\
**Post date:** [January 30, 2024, 2:53pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/6 "2024-01-30T14:53:27Z")

</div>

Thanks Rueben! Highly appreciated. I will give that a try!

---

<div class="post-metadata">

**Author:** ![malanciault](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/malanciault/32/51306_2.png) [@malanciault](https://community.auth0.com/u/malanciault)\
**Post date:** [February 1, 2024, 3:17pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/7 "2024-02-01T15:17:57Z")

</div>

OK, so here is what we have so far, but there is still something not working, or, more accurately, that we don’t understand ;).

- User signup on our custom page
- We store user in our database
- Using Auth0 API Management, we create the user with [Auth0 Management API v2](https://auth0.com/docs/api/management/v2/users/post-users)
- Using Auth0 API Management, we add user to specific Auth0 Organization with [Auth0 Management API v2](https://auth0.com/docs/api/management/v2/organizations/post-members)

Then, on our custom signup page, using Auth0 Javascript SDK we login the user on Auth0 using auth0.webAuth.login(). It works, BUT, the user is presented with this page to authorize the app:

 ![Markup on 2024-02-01 at](https://global.discourse-cdn.com/auth0/original/3X/7/e/7ee3b30a54524820ee66b11f0931c3b41e3f1ebe.jpeg)

Is there a way to avoid this ? What are we missing?

Here is the javascript code used:

```auto
<script src="https://cdn.auth0.com/js/auth0/9.24.1/auth0.min.js"></script>
        <script type="text/javascript">

            var auth0 = new auth0.WebAuth({
                domain: 'xxx',
                clientID: 'xxx',
                organization: 'xxx'
            });

            auth0.login(
                {
                    realm: 'xxx', //connection name or HRD domain
                    email: 'xxx',
                    password: 'xxx',
                    audience: 'https://xxx.auth0.com/api/v2/',
                    scope: '',
                    responseType: 'token',
                    redirectUri: 'xxx'
                },
                function (err, authResult) {
                    // Auth tokens in the result or an error
                }
            );
        </script>

```

Thanks!!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 1, 2024, 5:25pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/8 "2024-02-01T17:25:15Z")

</div>

Hi @malanciault,

Thanks for the update.

Yes, you can skip the consent page only for first-party applications. You can do this by going to your API settings on the dashboard and enabling the **Allow Skipping User Consent** option.

It’s unfortunately not possible with third-party applications as they are assumed to be untrusted.

See [User Consent and Third-Party Applications](https://auth0.com/docs/get-started/applications/confidential-and-public-applications/user-consent-and-third-party-applications#skip-consent-for-first-party-applications) for more details.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![malanciault](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/malanciault/32/51306_2.png) [@malanciault](https://community.auth0.com/u/malanciault)\
**Post date:** [February 1, 2024, 6:58pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/9 "2024-02-01T18:58:13Z")

</div>

And it works !! You are the man 🙂 Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 15, 2024, 6:58pm UTC](https://community.auth0.com/t/creating-user-on-our-app-and-log-user-in-auth0-automatically/125618/10 "2024-02-15T18:58:18Z")

</div>

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