# Creating a custom login page under Universal Login

**URL:** <https://community.auth0.com/t/creating-a-custom-login-page-under-universal-login/96419>\
**Category:** Get Help\
**Tags:** custom-login, universal-login\
**Created:** [December 14, 2022, 8:31am UTC](https://community.auth0.com/t/creating-a-custom-login-page-under-universal-login/96419 "2022-12-14T08:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![platform-admin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/platform-admin/32/34862_2.png) [@platform-admin](https://community.auth0.com/u/platform-admin)\
**Post date:** [December 14, 2022, 8:31am UTC](https://community.auth0.com/t/creating-a-custom-login-page-under-universal-login/96419/1 "2022-12-14T08:31:01Z")

</div>

Hi,  
I am trying to create a custom login page in React, under Universal Login.  
So I created a react login page using “auth0-js” lib and added the built artifact as inlined script tags in the custom page.  
The react page loads for me.

How ever initializaing & calling webAuth.login goes to “/co/authenticate” endpoint(which is meant for call outside UL login page). I was expecting it to goto “/usernamepassword/login” endpoint.(which is the call to UL login from inside).  
And after successful login (can see the logs), it redirects back to the same login page.  
Where am I going wrong?

```auto
const params = Object.assign({
   domain: process.env['NX_REACT_APP_AUTH0_DOMAIN'],
   clientID: process.env['NX_REACT_APP_AUTH0_CLIENT_ID'],
   responseType: 'code'
});
const urlParams = new URLSearchParams(window.location.search);
const stateParam = urlParams.get('state') || '';
const webAuth = new auth0.WebAuth(params);
 webAuth
    .login(
         {
              realm: process.env['NX_REACT_APP_AUTH0_DATABASE'],
              username: data.username,
              password: data.password,
              responseType: 'code',
              redirectUri: process.env['NX_REACT_APP_AUTH0_REDIRECT_URI'],
              state: stateParam
         }, 
         function(err) {
              console.error(err);
         }
    );

```

---

<div class="post-metadata">

**Author:** ![shubham2](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shubham2/32/51177_2.png) [@shubham2](https://community.auth0.com/u/shubham2)\
**Post date:** [February 6, 2024, 4:12pm UTC](https://community.auth0.com/t/creating-a-custom-login-page-under-universal-login/96419/2 "2024-02-06T16:12:42Z")

</div>

Maybe it’s not an issue for you anymore, but I realised the hard way that you need to remove the `https://` from your `NX_REACT_APP_AUTH0_DOMAIN` So if your auth0 app domain is `https://something.auth0.com` then `NX_REACT_APP_AUTH0_DOMAIN=something.auth0.com`

---

<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:** [December 3, 2024, 2:48am UTC](https://community.auth0.com/t/creating-a-custom-login-page-under-universal-login/96419/3 "2024-12-03T02:48:17Z")

</div>

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