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.