# Login using oauth/toke 2 apps

**URL:** <https://community.auth0.com/t/login-using-oauth-toke-2-apps/136634>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [June 19, 2024, 8:29am UTC](https://community.auth0.com/t/login-using-oauth-toke-2-apps/136634 "2024-06-19T08:29:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit.mahajan](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@amit.mahajan](https://community.auth0.com/u/amit.mahajan)\
**Post date:** [June 19, 2024, 8:29am UTC](https://community.auth0.com/t/login-using-oauth-toke-2-apps/136634/1 "2024-06-19T08:29:57Z")

</div>

I have `app1` (a React/Next.js app) running on `localhost:3000`. It includes a login page that uses the `auth0.com/oauth/token` endpoint to authenticate users and retrieve the `access_token`, `id_token`, and `refresh_token`. Now, I want to forward users to `app2`, which is running on `localhost:3001`. This app is also built with React/Next.js and uses `@auth0/nextjs-auth0` to manage tokens and protect routes. How can I pass the token from `app1` to `app2` so that `app2` doesn’t need to re-authenticate the user, while also handling all the callbacks and `nextjs-auth0` configurations?

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [June 28, 2024, 10:47am UTC](https://community.auth0.com/t/login-using-oauth-toke-2-apps/136634/2 "2024-06-28T10:47:30Z")

</div>

Hi @amit.mahajan

Welcome to the Auth0 Community!

I think that you should benefit from this response → [Sharing authentication between 2 sites - #2 by jmangelo](https://community.auth0.com/t/sharing-authentication-between-2-sites/7885/2) which generally boils down to this:

> 1. The end-user accesses application `A` which has no idea who the user is so it makes a [non-interactive request](https://auth0.com/docs/api-auth/tutorials/silent-authentication#initiate-a-silent-authentication-request) to `idp` as a way to verify if the current end-user has already authenticated.
> 2. If the end-user never authenticated before application `A` is notified of that and redirects the end-user to the `idp` authorization endpoint where the end-user will authenticate through the [hosted login page](https://auth0.com/docs/hosted-pages/login).
> 3. If the end-user already authenticated before application `A` will receive the user identity and any applicable tokens and proceed to treat the end-user as authenticated.
> 4. The end-user accesses application `B` which has no idea who the user is and a similar dance as above is done, however, now the user is already authenticated so application `B` will be able to treat the user as authenticated without requiring end-user interaction.
> 
> The key points from above is that an application can inquire if a user is already authenticated in a non-interactive way (without user intervention). In case of success the application can proceed to use the current user identity and any applicable tokens received. If the response is negative then the application should redirect the user through the hosted login page so that he can authenticate and at the same time start an authenticated session at the `idp`.

Thanks  
Dawid

---

<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:** [July 12, 2024, 10:47am UTC](https://community.auth0.com/t/login-using-oauth-toke-2-apps/136634/3 "2024-07-12T10:47:50Z")

</div>

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