Creating a Custom Social Connection for Reddit with Auth0

I’m trying to create a custom social connection for Reddit using Auth0. Here’s what I have set up so far:

  • Authorization URL: https://www.reddit.com/api/v1/authorize
  • Token URL: https://www.reddit.com/api/v1/access_token
  • Scope: identity,read,submit
  • Client ID & secret taken from the Reddit app I created

I’ve also implemented the following Fetch User Profile Script:

function(accessToken, ctx, cb) {
  request.get('https://oauth.reddit.com/api/v1/me', {
    headers: {
      'Authorization': 'Bearer ' + accessToken,
      'User-Agent': 'Auth0/1.0'
    }
  }, function(e, r, b) {
    if (e) return cb(e);
    if (r.statusCode !== 200) return cb(new Error('StatusCode: ' + r.statusCode));
    var profile = JSON.parse(b);
    cb(null, {
      user_id: profile.id,
      username: profile.name,
      email: profile.email || ''
    });
  });
}

However, when I try the connection, I get the following error:

{
  "error": "invalid_request",
  "error_description": "the connection is not enabled"
}

I’m not sure what I need to insert into the custom header. I found this post but I’m still having trouble defining the user profile script and the custom header. Any help would be appreciated.

2 Likes

Hi @maxhager28,

Welcome to the Auth0 Community!

This error indicates that you have not enabled the connection for any applications. To use the “Try” function, you need to enable an application for the connection. Here’s an example of a connection’s settings with an application enabled.

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