Hi I have been trying to do custom social login and I have setup all accordingly, including the Fetch User Script. I am not sure where I am doing wrong. I put the url correctly ‘https://{mydomain}/userinfo’
function fetchUserProfile(accessToken, context, callback) {
request.get(
{
url: 'https://mydomain/userinfo',
headers: {
'Authorization': 'Bearer ' + accessToken,
}
},
(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 = {
user_id: bodyParsed.sub,
email: bodyParsed.email
};
callback(null, profile);
}
);
}
this is my Fetch User Profile Script