Search code examples
laravellaravel-socialite

How to fix Laravel Declaration of SocialiteProviders refresh token must be compatible error


I've recently upgraded to Laravel 10 and am trying to simply run composer up. My composer file looks like:

"require": {
    "php": "^8.2",
    ...
    "laravel/socialite": "^5",
    ...
    "socialiteproviders/apple": "^5"
},

However, I'm getting the error:

PHP Fatal error: Declaration of SocialiteProviders\Apple\Provider::refreshToken(string $refreshToken): Psr\Http\Message\ResponseInterface must be compatible with Laravel\Socialite\Two\AbstractProvider::refreshToken($refreshToken) in /Users/user/Sites/site/vendor/socialiteproviders/apple/Provider.php on line 289

It seems like I have the latest providers for both Apple and Socialite, and this isn't custom code in any sense, so I'm not sure what to do with this. Any thoughts would be greatly appreciated!


Solution

  • According to this link https://github.com/laravel/socialite/issues/677, you won't be able to run it if you attempt to use version 5.11 of socialite. You can temporarily force version 5.10 as a hack until a new version that corrects the errors is released. I faced the same problem while installing Bookstack, and my temporary solution was to edit composer.json and change the line

        "laravel/socialite": "^5.8",
    

    to

        "laravel/socialite": "5.10",