mdurao's avatar

Laravel Socialite and Laravel 5.4

I'm getting this error:

production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Session\Store::set() in /home/forge/admindev.cultoc.com/vendor/laravel/socialite/src/Two/AbstractProvider.php:143
Stack trace:
#0 /home/forge/admindev.cultoc.com/app/Http/Controllers/Auth/LoginController.php(55): Laravel\Socialite\Two\AbstractProvider->redirect()
#1 [internal function]: App\Http\Controllers\Auth\LoginController->redirectToProvider()
...

From my research on the error, must be related to this:

Symfony Compatibility

Laravel's session handlers no longer implements Symfony's SessionInterface. Implementing this interface required us to implement extraneous features that were not needed by the framework. Instead, a new Illuminate\Contracts\Session\Session interface has been defined and may be used instead. The following code changes should also be applied:

All calls to the ->set() method should be changed to ->put(). Typically, Laravel applications would never call the set method since it has never been documented within the Laravel documentation. However, it is included here out of caution.

All calls to the ->getToken() method should be changed to ->token().

All calls to the $request->setSession() method should be changed to setLaravelSession().

How can I fix it?

Thank you in advance,

Miguel

0 likes
8 replies
leolam2005's avatar

Same issue here.

Looks like the method is removed while these packages are still reference the store method.

leolam2005's avatar

A temporary fix is to go to

\vendor\laravel\socialite\src\One

\vendor\laravel\socialite\src\Two

in AbstractProvider.php, change "set" method to "put"

    public function redirect()
    {
        $this->request->session()->put(
            'oauth.temp', $temp = $this->server->getTemporaryCredentials()
        );

        return new RedirectResponse($this->server->getAuthorizationUrl($temp));
    }

it would be nice if you create an issue on github too

1 like

Please or to participate in this conversation.