dreamfactorysoftware / df-oauth

OAuth support for DreamFactory 2.0
Apache License 2.0
6 stars 8 forks source link

Breaking change in GoogleProvider between laravel/socialite:2.0.21 and laravel/socialite:2.0.22 #5

Open isreehari opened 5 years ago

isreehari commented 5 years ago

There is breaking change in GoogleProvider between laravel/socialite:2.0.21 and laravel/socialite:2.0.22

https://github.com/laravel/socialite/releases/tag/v2.0.22

/**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {
        $avatarUrl = Arr::get($user, 'picture');

        return (new User)->setRaw($user)->map([
            'id' => Arr::get($user, 'id'),
            'nickname' => Arr::get($user, 'nickname'),
            'name' => Arr::get($user, 'name'),
            'email' => Arr::get($user, 'email'),
            'avatar' => $avatarUrl,
            'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', $avatarUrl),
        ]);
    }

https://github.com/laravel/socialite/releases/tag/v2.0.21

 /**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {
        return (new User)->setRaw($user)->map([
            'id' => $user['id'], 
            'nickname' => Arr::get($user, 'nickname'), 
            'name' => $user['displayName'],
            'email' => $user['emails'][0]['value'], 
            'avatar' => Arr::get($user, 'image')['url'],
            'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', Arr::get($user, 'image')['url']),
        ]);
    }
isreehari commented 5 years ago

Think it would be better if we contact the laravel/socialite team to remove the 2.0.22 because it's breaking changes it should be major version release than the minor fix. Please suggest me it would be good idea. @leehicks or we will update our repo?

wjgilmore commented 5 years ago

Hi @isreehari I recommend getting in touch with the laravel/socialite team as it sounds like this is something they would need to address. There very well may be a discussion going on about this matter in their issue tracker?

isreehari commented 5 years ago

Hi @wjgilmore it seems to me like we need just need to modify the GoogleProvider in our code because when I compare between 2.0.21 and 2.0.22 there is only one major difference in GoogleProvider file.

https://github.com/laravel/socialite/compare/v2.0.21...laravel:v2.0.22

I already put a ticket there and we will see if someone get back to us - https://github.com/laravel/socialite/issues/356