laravel / socialite

Laravel wrapper around OAuth 1 & OAuth 2 libraries.

Home Page:https://laravel.com/docs/socialite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception on Linkedin: Undefined array key "storageSize"

alkin opened this issue · comments

Socialite Version

5.8.1

Laravel Version

9.52

PHP Version

8.2

Database Driver & Version

No response

Description

A small set of Users are getting an exception when trying to connect with Linkedin. I believe Linkedin is not returning the avatar image as expected by Socialite.

image

My suggestion is to simply ignore this error using "@" before the expression:

return @$image['data']...

Steps To Reproduce

We couldn't find a way to reproduce the bug. But this affects specific users every time. Probably there is something different with their accounts or avatars, so that linkedin API returns a slightly different data.

I'm also facing the same issue.
Found out the storageSize key is replaced by displaySize in LinkedIn response.

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Are you sure you don't need to use the openid linkedin provider instead of the regular one?

I guess i could use the OpenID provider but i believe that wouldn't solve the problem for the regular provider.

We have been using the regular LinkedIn provider for years on this specific project without problems. Without any changes to our code, we started experiencing the exception described. This means that Linkedin changed their behavior and how avatar images are saved internally. We should update socialite to consider this change. Otherwise, i believe more and more people will start to experience the issue, as Linkedin moves to this new data structure.

I will test the OpenID provider soon and post here the results.

Feel free to re-open if the openid provider didn't solve your problem 👍

facing same issue