0
votes

a have some strange issue. I use laravel 5.4 and Socialite.

The issue is: When i move to /auth/social/facebook it redirects me to facebook, and all fine, but, when it redirect me to my web site, it can't get access_token.

That's my social Controller (it works fine with other social providers)

public function handle($provider, SocialAccountService $service)
{
    try {
        $userData = Socialite::driver($provider)->user();
    } catch (Exception $e) {
        return redirect(route('auth.social', ['provider' => $provider]));
    }
    $user = $service->findOrCreateUser($userData, $provider);
    auth()->login($user);

    return redirect()->to('/');
}

public function redirect($provider)
{
    return Socialite::driver($provider)->redirect();
}

The exception i get from facebook

GET https://graph.facebook.com/v2.8/me?access_token=&fields=name,email,gender,verified,link&appsecret_proof={sometoken} resulted in a 400 Bad Request response: {"error":{"message":"An active access token must be used to query information about the current user."

1

1 Answers

0
votes

Solution is, require package again

composer require laravel/socialite
composer update

it will update packages, and all works fine