Laravel Socialite - google login failed "Missing required parameter: client_id" although specified Laravel Socialite - google login failed "Missing required parameter: client_id" although specified nginx nginx

Laravel Socialite - google login failed "Missing required parameter: client_id" although specified


With env() function in the services.php file, you must use GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET in the .env file, without white spaces.

GOOGLE_CLIENT_ID=xxxxxxxxxxxx    GOOGLE_CLIENT_SECRET=xxxxxxxxxxxxxx

in the services file, use this

'client_id' => env('GOOGLE_CLIENT_ID'),         'client_secret' => env('GOOGLE_CLIENT_SECRET'),


I just solved the same problem, my first solution is by passing the client_id and secret on the controller using the ->with(). Code goes like this:

    return Socialite::driver('google')    ->with(        ['client_id' => 'xxxxxxxx'],        ['client_secret' => 'xxxxxxxx'],        ['redirect' => 'http://localhost:8000/Yourcallback'])    ->redirect();

OR just by removing the env() on services.php

    'client_id' => env('xxxxxxx'),    'client_secret' => env('xxxxxxx'),

with this

'client_id' => 'xxxxxxx','client_secret' => 'xxxxxxx',

Its seems that Socialite does not recoginized env() function.


For people out there that are using Forge, you may need to add the google .env information in the environment tab on your Forge panel. This .env information is not pushed through Github to Forge.