# Access source application in pre user registration action

**URL:** <https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [August 22, 2023, 3:58am UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180 "2023-08-22T03:58:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SujayPrabhu96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sujayprabhu96/32/45599_2.png) [@SujayPrabhu96](https://community.auth0.com/u/SujayPrabhu96)\
**Post date:** [August 22, 2023, 3:58am UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/1 "2023-08-22T03:58:58Z")

</div>

In our setup, we are utilizing Auth0 for user authentication across two distinct React applications. The Auth0 actions have been employed to manage specific custom flows within the authentication process. At present, I am seeking a solution to determine the origin of the user in the Pre-registration hook. Specifically, I need to identify from which of the two applications the user is initiating the registration process. Could you please provide guidance on how to achieve this? At present, we have two separate applications set up in Auth0, each corresponding to one of our React applications. However, we now intend to establish a scenario where both of these React applications can interact seamlessly with a single Auth0 application

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 22, 2023, 11:31pm UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/3 "2023-08-22T23:31:58Z")

</div>

Hello there @SujayPrabhu96 !

> [@SujayPrabhu96](#):
>
> Specifically, I need to identify from which of the two applications the user is initiating the registration process. Could you please provide guidance on how to achieve this?

You should be able to get this information in the pre-registration Action itself - Specifically, the `event.client.id` property.

> **[Actions Triggers: pre-user-registration - Event Object](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow/event-object)**
>
> Learn about the pre-user-registration Action trigger's event object, which provides contextual information about the request to register a new user.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![SujayPrabhu96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sujayprabhu96/32/45599_2.png) [@SujayPrabhu96](https://community.auth0.com/u/SujayPrabhu96)\
**Post date:** [August 23, 2023, 3:21am UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/4 "2023-08-23T03:21:13Z")

</div>

Hi tyf,

Thank you for your reply. I am aware of this solution and this works when there are 2 Auth0 applications for 2 React applications. But I want to have single Auth0 application for 2 React applications

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 23, 2023, 11:25pm UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/5 "2023-08-23T23:25:37Z")

</div>

Ah, gotcha! Thanks for clarifying 🙂

That’s tricky and I can’t think of an easy out of the box solution so to speak - Out of curiosity, what’s the reason for wanting to have a single Auth0 application as opposed to 2?

---

<div class="post-metadata">

**Author:** ![SujayPrabhu96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sujayprabhu96/32/45599_2.png) [@SujayPrabhu96](https://community.auth0.com/u/SujayPrabhu96)\
**Post date:** [August 24, 2023, 7:36am UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/6 "2023-08-24T07:36:16Z")

</div>

Hi tyf,

We want to merge 2 Auth0 application into 1 to avoid maintaining 2 applications in Auth0 and when there is slightly different user flow, we feel it is unnecessary to have 2 applications.  
I want to know your opinion on this. What is the approach that Auth0 suggests and are there any concerns if we have single Auth0 application instead of 2?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 24, 2023, 11:30pm UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/7 "2023-08-24T23:30:07Z")

</div>

Awesome, thanks for clarifying!

> [@SujayPrabhu96](#):
>
> What is the approach that Auth0 suggests and are there any concerns if we have single Auth0 application instead of 2?

The suggested approach is to use 2 separate applications in Auth0 - A handful of concerns might be security (introducing a greater CSRF attack surface, token leakage, etc.), configuration (callback urls, CORS settings, etc.), monitoring (same client id for separate apps could be hard to monitor), logout/session management, confusing permissions/user consent, among others.

---

<div class="post-metadata">

**Author:** ![SujayPrabhu96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sujayprabhu96/32/45599_2.png) [@SujayPrabhu96](https://community.auth0.com/u/SujayPrabhu96)\
**Post date:** [August 25, 2023, 6:00am UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/8 "2023-08-25T06:00:11Z")

</div>

Hey tyf,

What if I want to share login information among applications? Say, I have logged in for App1 & if I visit App2 I want myself to be in logged in state. Is it possible to achieve this without having single Auth0 application?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 25, 2023, 11:40pm UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/9 "2023-08-25T23:40:18Z")

</div>

Hey @SujayPrabhu96! Absolutely, that’s describing [SSO](https://auth0.com/docs/authenticate/single-sign-on) 🙂

The user flow is roughly as follows:

1. **Login in App 1** : The user logs into the first application. Auth0 sets an SSO cookie for the Auth0 domain.
2. **Navigate to App 2** : The user then navigates to the second application. If you implement [silent authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication), the application can check for the SSO cookie set by Auth0. If the cookie exists (and is valid), the user is considered logged in. If not, the user will be prompted to log in.
3. **Token Retrieval** : Each application can independently retrieve tokens (ID tokens, access tokens, refresh tokens) from Auth0 upon successful authentication, which can be used for making authenticated API calls.

Hope this helps!

---

<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:** [September 8, 2023, 11:41pm UTC](https://community.auth0.com/t/access-source-application-in-pre-user-registration-action/114180/10 "2023-09-08T23:41:13Z")

</div>

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