Farhan
Farhan

Reputation: 752

Linkedin profile image url giving access denied

I have used Spring social for integration with linkedin.

When the integration completes we save the users profile image which has below url:

https://media.licdn.com/dms/image/C5603AQHQ0C7xKhQehg/profile-displayphoto-shrink_100_100/0?e=1527508800&v=alpha&t=vkxX_3Uw7qe8d_9ZSqPwQGpwa6nfUmkzMgEKtMdgf1g

But this url is giving access denied error. Is there something I am missing?

Upvotes: 0

Views: 3817

Answers (2)

Massi
Massi

Reputation: 107

I looked at the URL of my picture of my In Public profile and the one returned from the API.

The picture URL in the XML returned after the ? for params v and t had &amp ; instead of &:

e.g. https://media.licdn.com/.../profile-displayphoto-shrink_200_200/0?e=152800"&amp";v=beta"&amp";t=LJTrw_oj9npH06X1u0HjQ

Replacing it with something like:

pictureURL = pictureURL.replaceAll("&amp ;","&");

fixed the issue for me. Hope this helps

Note that there is an extra space between &amp and ;. It would have formatted otherwise.

Upvotes: 2

Satys
Satys

Reputation: 2435

This may help, As per https://developer.linkedin.com/docs/ref/v2/media-migration,

The new id will be dynamic and can change from time to time. We recommend retrieving at least once every 60 days to update your media-typed URN.

This could be one of the issue which you might be facing.

In order to fix this, I save the image, the moment it is received on to personal storage(AWS S3).

Upvotes: 4

Related Questions