This question already has an answer here:
I have strange problem with facebook provider in my project (Laravel 5.2);
Undefined variable: access_token vendor/laravel/socialite/src/Two/FacebookProvider.php 80
It's strange because it worked long time and now i have error. Nothing was changed in my code.
</div>
It may be caused by the depreciation of v2.2 Graph API.
Checkout the changelog at facebook.
In v2.3 Graph API, Oauth Access Token calls now return a valid JSON message insted of an encoded URL.
The new format of this response is {"access_token": {TOKEN}, "token_type":{TYPE}, "expires_in":{TIME}}.
I make a patch and it works for me. In vendor/laravel/socialite/src/Two/FacebookProvider.php Replace
parse_str($body, $data);
return $access_token;
With
parse_str($body, $data);
$json = json_decode(key($data));
return $json->access_token;