And also when i try to dump the error. It shows nothing at the place of $e->getMessage() . The output is
"Something went wrong!! : " // app\Http\Controllers\AuthController.php:77
config/services.php
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_REDIRECT'),
],
web.php
Route::get('/auth/facebook', [AuthController::class, 'facebookPage'])->name('facebook.page');
Route::get('/auth/facebook/callback', [AuthController::class, 'facebookRedirect'])->name('facebook.redirect');
AuthController.php
public function facebookPage(){
return Socialite::driver('facebook')->redirect();
}
public function facebookRedirect(){
try{
$user = Socialite::driver('facebook')->user();
dd($user);
}catch(Exception $e){
dd('Something went wrong!! : ' . $e->getMessage() );
}
}
View file :
<a href="{{ url('/auth/facebook') }}">Login with Facebook</a>