A free open source IT asset/license management system
Create constructor to override expected config variables
snipee5eb5932ca9f
diff --git a/app/Http/Controllers/GoogleAuthController.php b/app/Http/Controllers/GoogleAuthController.phpindex fea45f5b61..29dfc9c1a0 100644--- a/app/Http/Controllers/GoogleAuthController.php+++ b/app/Http/Controllers/GoogleAuthController.php@@ -7,10 +7,23 @@ use App\Models\User;use Illuminate\Support\Facades\Auth;use Laravel\Socialite\Facades\Socialite;use Laravel\Socialite\Two\InvalidStateException;+use App\Models\Setting;class GoogleAuthController extends Controller{+ /**+ * We need this constructor so that we override the socialite expected config variables+ */+ public function __construct()+ {+ parent::__construct();+ $setting = Setting::getSettings();+ config(['services.google.redirect' => config('app.url').'/google/callback']);+ config(['services.google.client_id' => $setting->google_client_id]);+ config(['services.google.client_secret' => $setting->google_client_secret]);+ }+public function redirectToGoogle(){return Socialite::driver('google')->redirect();