I have this strange issue with using Laravel Socialite to log users in via Google API.
Everything configurations seem normal and ordinary, but I keep getting error Missing required parameter: client_id. Not only that, sometimes I tried again and the error became Missing required parameter: redirect_uri despite all these parameters have been supplied.
This is how it is set up:
service.php
'google' => [
'client_id' => 'xxxxxxxxxx-x98asxxxx913ofk5tqvgq7lqfpgdi5u2.apps.googleusercontent.com',
'client_secret' => 'mklOWJFhpbCzTKxxxx-xxxx',
'redirect' => 'http://myapp.com/auth/google/callback'
],
routes.php
Route::get('/auth/{social_channel}', 'Auth\AuthController@redirect_to_provider');
Route::get('/auth/{social_channel}/callback', 'Auth\AuthController@handle_provider_callback');
AuthController.php
/**
* Redirect the user to the Google authentication page.
*
* @return Response
*/
public function redirect_to_provider($social_channel)
{
return Socialite::driver($social_channel)->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return Response
*/
public function handle_provider_callback($social_channel, SocialAccountService $service)
{
$user = $service->create_or_get_user($social_channel, Socialite::driver($social_channel)->user());
Auth::login($user);
return redirect()->to('/go');
}
Facebook Login works for me, just this Google Login issue is a stubborn and bizarre problem.
The app is deployed on Forge (Ubuntu, Nginx).
Can anybody spot anything wrong with this at all?