Conditionally set connection_scope based on social connection?

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:

auth = await authorize({
        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?

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.

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

1 Like

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