# Determine current tenant within fetch user profile script

**URL:** <https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101>\
**Category:** Get Help\
**Tags:** custom-social-connections-branding, connections\
**Created:** [March 20, 2024, 3:39pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101 "2024-03-20T15:39:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkay](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jkay/32/73877_2.png) [@jkay](https://community.auth0.com/u/jkay)\
**Post date:** [March 20, 2024, 3:39pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101/1 "2024-03-20T15:39:38Z")

</div>

I am creating a custom social connection, and working on the Fetch User Profile Script. I have two different auth0 tenants and would like to use the same Fetch User Profile Script in both, with logic inside the script to do slightly different things depending on the current tenant. Is there a way to determine the auth0 tenant of context within the Fetch User Profile Script?

---

<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:** [March 20, 2024, 11:02pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101/4 "2024-03-20T23:02:09Z")

</div>

Hey there @jkay!

Does `context.tenant` work for your needs?

---

<div class="post-metadata">

**Author:** ![jkay](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jkay/32/73877_2.png) [@jkay](https://community.auth0.com/u/jkay)\
**Post date:** [March 21, 2024, 3:44pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101/5 "2024-03-21T15:44:41Z")

</div>

It doesn’t look like the context object has a tenant property on it. Here is the structure of that object inside of the event:

```auto
{
    "id_token": "stringValue",
    "options": {
        "authorizationURL": "stringValue",
        "client_id": "stringValue",
        "client_secret": "stringValue",
        "scope": "stringValue",
        "store": {
        },
        "tokenURL": "stringValue"
    },
    "token_type": "stringValue"
}

```

---

<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:** [March 21, 2024, 10:53pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101/6 "2024-03-21T22:53:21Z")

</div>

Hmm… does the `authorizationUrl` not tell you which tenant is used? I suppose you could also deduce from the `client_id`?

---

<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 4, 2024, 10:53pm UTC](https://community.auth0.com/t/determine-current-tenant-within-fetch-user-profile-script/130101/7 "2024-04-04T22:53:39Z")

</div>

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