I recently started playing around with the linkedin v2 api .I am trying to get the profile image url after sucessfull authentication
I sent a request to this end point https://api.linkedin.com/v2/me?projection=(id,profilePicture(displayImage~:playableStreams))&oauth2_access_token=${accessToken}
and get the users information containing the profile image details
i am having problem selecting the secound 'displayImage~' field from the response.
{
profilePicture: {
displayImage: 'urn:li:digitalmediaAsset:CgiiriBq9LJg8yRQ',
'displayImage~': { paging: [Object], elements: [Array] }
},
id: 'linkedin_id'
}
below is a copy of my code
getProfilePic(accessToken) {
return new Promise((resolve, reject) => {
const url = `https://api.linkedin.com/v2/me?projection=(id,profilePicture(displayImage~:playableStreams))&oauth2_access_token=${accessToken}`;
request.get({ url: url }, (err, response, body) => {
if (err) {
console.log(err);
return reject(err);
}
// const { id, localizedFirstName, localizedLastName, } = body localizedFirstName
let data = JSON.parse(body);
imgDetails = data.displayImage~
return resolve(data);
});
});
}