I am using Laravel 5.3 with Socialite.
I am getting 400 Bad Request error with message:
Missing required parameter: redirect_uri
The URL it generates is:
https://accounts.google.com/o/oauth2/auth?scope=openid+profile+email&response_type=code&state=RYPmT1B93CaUdi44Z7iwfmRPx3hIy7an7yxAVY9l
Details below:
service.php
'google' => [
'client_id' => '1234455-u3ifk8tr1qs41487fmevg2h2s1v6ubue.apps.googleusercontent.com',
'client_secret' => 'DxSOS0p1xKNuPger3IS_E4-i',
'redirect' => 'http://localhost:8000/google/callback',
],
Routes
Route::get('/{provider}/redirect', 'Auth\RegisterController@redirectToProvider');
Route::get('/{provider}/callback', 'Auth\RegisterController@handleProviderCallback');
Authorized URI settings in Google Console
http://localhost:8000/google/callback
Controller
public function handleProviderCallback($provider)
{
try {
$social_user = Socialite::driver($provider)->user();
} catch (Exception $e) {
return redirect('/');
}
}