I'm using Socialite to authenticate my users via Facebook. However, I can't get it to work. I followed this tutorial, but I get the following error:
I looked everywhere and tried whatever, but I can't get it to work. Here's my code:
In services.php:
'facebook' => [
'client_id' => '[My App ID]',
'client_secret' => '[My App Secret]',
'redirect' => 'http://localhost:8000/auth/facebook/callback/',
],
My routes:
Route::group(['middleware' => ['web', 'requestlog']], function () {
Route::get('auth/facebook', 'Auth\AuthController@redirectToProvider');
Route::get('auth/facebook/callback/', 'Auth\AuthController@handleProviderCallback');
});
Then in my AuthController:
public function redirectToProvider()
{
return Socialite::driver('facebook')->redirect();
}
public function handleProviderCallback()
{
try {
$providerUser = Socialite::driver('facebook')->user();
dd('yay it worked!');
} catch (RequestException $e) {
dd($e->getResponse()->json());
}
}
Then I have these settings in FB:
What is going wrong? I followed all the necessary steps as far as I know. I don't get what's wrong here. I hope I provided all the nessecary information!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire