Twitch connection_scope

Hello,
I’m using the Twitch social connection and it works fine.
Following the advice here I’m passing connection_scope: 'clips:edit'.
It generates a request that reads scope=clips:edit,user:edit user:read:email (after decode).
Twitch expects the scopes to be space separated but the library concats the connection_scope with a comma.
Any way to workaround this?
Thank you

1 Like

Hi, did you find the workaround?

1 Like

+1 this seems like a bug in Auth0. @nicolas_sabena Can you please comment?

I found a workaround that (unfortunately) involves creating a custom social connection. See the pictured set up to configure Twitch’s OAuth URLs and use a space separated value for “Scope”. Here’s the fetchUserProfile script I’m using:

function fetchUserProfile(accessToken, ctx, callback) {
  request.get(
    {
      url: 'https://api.twitch.tv/helix/users',
      headers: {
        'Authorization': 'Bearer ' + accessToken,
        'Client-Id': ctx.options.client_id
      }
    },
    (err, resp, body) => {
      if (err) return callback(err);
      if (resp.statusCode !== 200) return callback(new Error(body));
      let bodyParsed;
      try {
        bodyParsed = JSON.parse(body);
      } catch (jsonError) {
        return callback(new Error(body));
      }
      const profile = bodyParsed.data[0];
      callback(null, profile);
    }
  );
}

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