mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Gmail offline_access
This commit is contained in:
parent
770b4c9776
commit
8a89973d7c
@ -491,23 +491,23 @@ class LoginController extends BaseController
|
|||||||
{
|
{
|
||||||
//'https://www.googleapis.com/auth/gmail.send','email','profile','openid'
|
//'https://www.googleapis.com/auth/gmail.send','email','profile','openid'
|
||||||
$scopes = [];
|
$scopes = [];
|
||||||
|
$parameters = [];
|
||||||
|
|
||||||
if($provider == 'google'){
|
if($provider == 'google'){
|
||||||
$scopes = ['gmail.send','email','profile','openid'];
|
$scopes = ['https://www.googleapis.com/auth/gmail.send','email','profile','openid'];
|
||||||
|
$parameters = ['access_type' => 'offline', 'redirect_uri' => config('ninja.app_url')."/auth/google"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request()->has('code')) {
|
if (request()->has('code')) {
|
||||||
return $this->handleProviderCallback($provider);
|
return $this->handleProviderCallback($provider);
|
||||||
} else {
|
} else {
|
||||||
return Socialite::driver($provider)->with(['redirect_uri' => config('ninja.app_url')."/auth/google"])->scopes($scopes)->redirect();
|
return Socialite::driver($provider)->with($parameters)->scopes($scopes)->redirect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleProviderCallback(string $provider)
|
public function handleProviderCallback(string $provider)
|
||||||
{
|
{
|
||||||
$socialite_user = Socialite::driver($provider)
|
$socialite_user = Socialite::driver($provider)->user();
|
||||||
->with(['redirect_uri' => config('ninja.app_url')."/auth/google"])
|
|
||||||
->user();
|
|
||||||
|
|
||||||
if($user = OAuth::handleAuth($socialite_user, $provider))
|
if($user = OAuth::handleAuth($socialite_user, $provider))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user