# I Need a seamless login between two applications (nextjs and spring mvc) using same auth0 client

**URL:** <https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225>\
**Category:** Get Help\
**Tags:** login-prompt-new-experience, login-experience\
**Created:** [January 5, 2024, 10:53am UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225 "2024-01-05T10:53:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijay22uk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vijay22uk/32/53692_2.png) [@vijay22uk](https://community.auth0.com/u/vijay22uk)\
**Post date:** [January 5, 2024, 10:53am UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/1 "2024-01-05T10:53:09Z")

</div>

**I Need a seems login between two applications (nextjs and spring mvc) using same auth0 client**

Hi,  
My Scenario is I have 2 application on auth0 one with nextjs and another with java spring mvc which uses database based and password less auth(email) respectively.  
I have setup cross origin access and I can see Java Session and nextJS session on cookies for both application.  
What i want is when i login to nextjs or spring application I don’t want to login into another application.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 8, 2024, 2:59pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/3 "2024-01-08T14:59:57Z")

</div>

Hi @vijay22uk,

Welcome to the Auth0 Community!

You can use [Single Sign-On](https://auth0.com/docs/authenticate/single-sign-on) to log in across multiple clients. I would not recommend using a single client to represent two different applications as you’ve suggested.

SSO is enabled by default in new tenants, and the user should be able to log without providing credentials once a cookie session has been established for the Auth0 domain.

---

<div class="post-metadata">

**Author:** ![vijay22uk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vijay22uk/32/53692_2.png) [@vijay22uk](https://community.auth0.com/u/vijay22uk)\
**Post date:** [January 8, 2024, 3:34pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/4 "2024-01-08T15:34:51Z")

</div>

Hi @dan.woda Thanks for the reply.  
These are 2 different application i.e different auth0 clients are being used and two sub domains.  
And in allowed CORs for SSO both application i have added corresponding but I get login srceen.  
Scenario -  
I login into APP 1(nextjs and react)  
I open APP 2(Java MVC) (It does’t use existing login/cookies and I have to login again).

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 8, 2024, 3:55pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/5 "2024-01-08T15:55:28Z")

</div>

Do they both navigate to the same domain for Auth? If so, the existing cookie session should allow the user to login without providing credentials.

For example, if I have appA on `a.example.com` and appB on `b.example.com` and they both redirect to `auth.example.com` to authorize (this is their auth0 domain), only the first login should require credentials.

You can test this using two of our [quickstarts](https://auth0.com/docs/quickstarts).

---

<div class="post-metadata">

**Author:** ![vijay22uk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vijay22uk/32/53692_2.png) [@vijay22uk](https://community.auth0.com/u/vijay22uk)\
**Post date:** [January 8, 2024, 4:06pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/6 "2024-01-08T16:06:37Z")

</div>

Yes they both(a. [a.example.com](http://a.example.com) and b [b.example.com](http://b.example.com)) goto same custom auth0 domain ([auth.example.com](http://auth.example.com)). with different redirectURL and ClientID.  
Also does this behaviour works on localhost port A and port B.

---

<div class="post-metadata">

**Author:** ![vijay22uk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vijay22uk/32/53692_2.png) [@vijay22uk](https://community.auth0.com/u/vijay22uk)\
**Post date:** [January 9, 2024, 9:38am UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/7 "2024-01-09T09:38:58Z")

</div>

Custom Auth0 domain is [example.auth0.com](http://example.auth0.com).

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 12, 2024, 4:09pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/8 "2024-01-12T16:09:10Z")

</div>

Sorry for the delay, I think I’ve found the issue.

> [@vijay22uk](#):
>
> one with nextjs and another with java spring mvc which uses database based and password less auth(email) respectively.

If you are using two different connections (db and passwordless), the user can’t SSO because these are _totally separate users_.

---

<div class="post-metadata">

**Author:** ![vijay22uk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vijay22uk/32/53692_2.png) [@vijay22uk](https://community.auth0.com/u/vijay22uk)\
**Post date:** [January 12, 2024, 4:47pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/9 "2024-01-12T16:47:28Z")

</div>

Hi Dan,  
Thanks for the clarification.

If we migrate/move another application to passwordless(email) will it work out of the box or something needs to be configured? Just need confirmation before changing the database to passwordless flow!

---

<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:** [January 26, 2024, 4:47pm UTC](https://community.auth0.com/t/i-need-a-seamless-login-between-two-applications-nextjs-and-spring-mvc-using-same-auth0-client/124225/10 "2024-01-26T16:47:37Z")

</div>

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