I have implemented API authentication using Passport and trying to do the same using Socialite but I am getting runtime exception error
Session store not set on request
This is what the endpoints look like following the laravel 5.8 documentation
Route::get('login/facebook', 'AuthController@facebookRedirect');
Route::get('login/facebook/callback', 'AuthController@facebookCallback');
In service.php file I have added facebook key like so
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_CALLBACK_URL'),
],
And the AuthController
methods are
public function facebookRedirect()
{
return Socialite::driver('facebook')->redirect();
}
public function facebookCallback()
{
return Socialite::driver('facebook')->stateless()->user();
$user->token;
}
In Postman and my browser I have called the api end point like this
http://localhost:8000/api/v1/login/facebook
What am I doing wrong? Is this the way to do API authentication using socialite?