I’m trying to create a custom social connection.
Here are my settings:
Name: reddit
Authorization URL: https://www.reddit.com/api/v1/authorize
Token URL: https://www.reddit.com/api/v1/access_token
Scope: identity
Fetch User Profile Script:
function(accessToken, ctx, cb) {
request.get('https://oauth.reddit.com/api/v1/me', {
headers: {
'Authorization': 'Bearer ' + accessToken
}
}, 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).data;
profile.user_id = profile.id;
cb(null, profile);
});
}
and no custom headers.
After I click “authorise” on reddit’s request for permission page, I get back the following error message:
{
"error": "server_error",
"error_description": "too few args to sprintf"
}
Observations: The fetch user profile script doesn’t run at all, reddit redirects to /login/callback
with both the code and the state included in the URL as expected.