I’ve been trying to get the “Fetch User Profile Script” to work with a custom social connection, and haven’t had any luck. I’m running a local instance of IdentityServer4 as the identity provider. The setup is essentially one of the IdentityServer4 quickstarts, with slight modifications.
When use a hard-coded profile like the first example listed here, I’m able to use the “Try” button, and everything works as expected. When I start to try to plug in in the userinfo endpoint in the “Fetch User Profile Script” from the endpoint is never being called according the the console logs. I am able to see the authorization and token endpoints being called, but the userinfo endpoint is never called. Any help is appreciated!
Is there anything special about the user profile script that I’m missing? Below is some additional information about my setup:
Authorization URL: http://localhost:5000/connect/authorize
Token URL: http://localhost:5000/connect/token
User Profile Script:
function(access_token, ctx, callback){
request({
method: 'GET',
url: 'http://localhost:5000/connect/userinfo',
headers: {
Authorization: 'Bearer ' + access_token
}
}, function(err, resp, body) {
if(err) {
return callback(err)
}
if(resp.statusCode !== 200) {
return callback(new Error('StatusCode:' + r.statusCode));
}
let profile = {
user_id: '12377',
given_name: 'Eugenio',
family_name: 'Pace',
email: 'eugenio@mail.com'
};
callback(null, profile);
});
}