# Auth0 Lock + Auth0 React + Universal login?

**URL:** <https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156>\
**Category:** Get Help\
**Tags:** react-sdk, lock, universal-login\
**Created:** [March 26, 2021, 10:16pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156 "2021-03-26T22:16:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 26, 2021, 10:16pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/1 "2021-03-26T22:16:45Z")

</div>

Hello,

I’m almost done with our auth flow migration to auth0! The last thing is to actually get a little more functionality than the standard `loginWithRedirect()` call via react-sdk.

Naturally, I found myself over to auth0-lock and in the documentation, it says that it can and should be used in conjunction with universal logins.

However, I have not been able to figure out how to do this. I have the form rendering in the page I want via `new Auth0Lock().show()` but when I log in, it just throws me back to my `redirectUrl` with a `code` query parameter, presumably to start the token exchange process.

If what I understand about Universal login is correct – a central, outside my domain auth server that does all of the token exchange and verifies it for you – then how do I hook this up to my auth0 lock instance?

Thank you, please let me know if I’m misunderstanding something which is entirely and probably likely possible.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [March 29, 2021, 6:54pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/3 "2021-03-29T18:54:44Z")

</div>

Hi @mclslee,

Glad to hear you are finishing up your migration!

It sounds like you are wanting to customize the Universal Login page, is that correct?

If that is the case, then instead of using an embedded login and including Lock.js in your application, you can instead use and customize the hosted Universal Login.

You would still use `loginWithRedirect()` in your application. You would then go to **Branding \> Universal Login** in your Auth0 dashboard. Select the **Classic Login Experience** and click **Save** :

 ![Screen Shot 2021-03-29 at 2.54.35 PM](https://global.discourse-cdn.com/auth0/original/3X/a/3/a329d716cde1cac570374ce6e83882a2f2503d8c.png)

Go to the **Login** tab and enable the **Customize Login Page** setting. From there you can customize the login page:

 ![Screen Shot 2021-03-29 at 2.54.17 PM](https://global.discourse-cdn.com/auth0/original/3X/5/e/5e0e95777b323272653334a860593a2490178d1e.png)

---

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 29, 2021, 6:59pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/4 "2021-03-29T18:59:08Z")

</div>

Hi @stephanie.chamblee

Thanks for the response. Yes we do want to customize the login page; however, simply switching to Classic and customizing it within auth0’s dashboards won’t work. We have a UX flow where the user logs in directly from the login page versus clicking on a button (or something) that redirects to auth0 universal login page, so we need the login form embedded on our page.

I got the form embedded, and now I even got logging in working, but now none of the silent authentication stuff is working; if a user logs in and opens another tab to our domain, they have to log in again. Do you have any tips for this?

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [March 29, 2021, 7:31pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/5 "2021-03-29T19:31:00Z")

</div>

Okay, that makes sense!

Are you using a [Custom Domain](https://auth0.com/docs/custom-domains) for your tenant? This is necessary to avoid [https://auth0.com/docs/login/embedded-login/cross-origin-authentication](https://auth0.com/docs/login/embedded-login/cross-origin-authentication) issues when using an [embedded login](https://auth0.com/docs/login/embedded-login).

---

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [March 29, 2021, 8:26pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/6 "2021-03-29T20:26:55Z")

</div>

No I dont believe so, just trying to have the embedded login form but keep as much as auth0’s heavy lifting as I can

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [March 30, 2021, 4:05pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/7 "2021-03-30T16:05:53Z")

</div>

I see! In order to get silent auth to work when using an embedded login, you’ll likely need to set up a Custom Domain. This is recommended to help mitigate security concerns as well as avoid the silent auth issues you are seeing which are likely related to cross-origin auth. Custom Domains are included with any paid subscription:

> **[Custom Domains](https://auth0.com/docs/customize/custom-domains?_ga=2.6855794.1353982928.1617016470-1595415333.1607347674)**
>
> Understand how a custom domain (CNAME or vanity URL) can help you unify your brand and show continuity to your users.

> **[Embedded Login](https://auth0.com/docs/authenticate/login/embedded-login)**
>
> Describes Auth0 Embedded Login used to log users directly into your application, transmitting credentials to the Auth0 server.

---

<div class="post-metadata">

**Author:** ![mclslee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mclslee/32/27980_2.png) [@mclslee](https://community.auth0.com/u/mclslee)\
**Post date:** [April 12, 2021, 5:25pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/8 "2021-04-12T17:25:03Z")

</div>

@stephanie.chamblee

Forgot to respond.

I didn’t need to use custom domains – though my manager wants to add it now – I was able to get it working using `checkSession` to return the last session/tokens for the current user

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [April 12, 2021, 5:28pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/9 "2021-04-12T17:28:22Z")

</div>

Thanks for following up! Glad to hear you found the solution.

---

<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:** [April 27, 2021, 5:28pm UTC](https://community.auth0.com/t/auth0-lock-auth0-react-universal-login/60156/10 "2021-04-27T17:28:39Z")

</div>

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