mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Create constructor to override expected config variables
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a90fc1ab59
commit
e5eb5932ca
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue