# Conditionally set connection\_scope based on social connection?

**URL:** <https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [March 8, 2024, 6:22pm UTC](https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283 "2024-03-08T18:22:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![duncan1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/duncan1/32/53596_2.png) [@duncan1](https://community.auth0.com/u/duncan1)\
**Post date:** [March 8, 2024, 6:22pm UTC](https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283/1 "2024-03-08T18:22:28Z")

</div>

I am using Auth0 with `expo` to sign in with Google and Apple.  
I need different scopes depending on which social connection the user chooses.

Here is my current code:

```auto
auth = await authorize({
        audience: ENVIRONMENT.API_AUDIENCE,
        scope: 'openid profile name email offline_access',
        additionalParameters: {
          access_type: 'offline',
          connection_scope: 'name email', //googleScopes.join(","),
        },
      });

```

Is there a way to conditionally set the connection scope depending on the social connection the user chooses?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [March 8, 2024, 9:00pm UTC](https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283/3 "2024-03-08T21:00:40Z")

</div>

Hi @duncan1,

AFAIK, there isn’t any way to conditionally set the `connection_scope` parameter based on the social connection the user is authenticating against.

As a workaround, you could append all the scopes you need in the request. This should, in practice, only receive access based on the scopes granted and recognized by the authorization server.

So, in cases where the scopes only apply to Google, then only these Google scopes will be used. And vice versa when using Apple.

---

<div class="post-metadata">

**Author:** ![duncan1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/duncan1/32/53596_2.png) [@duncan1](https://community.auth0.com/u/duncan1)\
**Post date:** [March 11, 2024, 5:49pm UTC](https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283/4 "2024-03-11T17:49:28Z")

</div>

Ah yes, that did work! For some reason, I got an invalid scope from apple at one point. Thank you!

---

<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:** [March 25, 2024, 5:49pm UTC](https://community.auth0.com/t/conditionally-set-connection-scope-based-on-social-connection/129283/5 "2024-03-25T17:49:59Z")

</div>

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