Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel socialite config access type as offline in google login

Well i'm trying to implement in laravel 5.1 the login with google using socialite and i don´t have problems with the scopes but i need to implement the access_type as offline, somebody know, how can i configure this in socialite for laravel?

this is my connection line

$scopes = [
        'https://www.googleapis.com/auth/plus.me',
        'https://www.googleapis.com/auth/plus.profile.emails.read',
        'https://www.googleapis.com/auth/gmail.readonly'

    ];
    return Socialize::driver('google')->scopes($scopes)->setAccessType('offline')->redirect();

thanks for your help

like image 882
Jean Andre Gonzalez Avatar asked Nov 29 '22 10:11

Jean Andre Gonzalez


1 Answers

Maybe an update since this question was last answered; looks like Taylor added functionality to pass optional parameters. Call the with method with an associative array:

$scopes = [
    'https://www.googleapis.com/auth/plus.me',
    'https://www.googleapis.com/auth/plus.profile.emails.read',
    'https://www.googleapis.com/auth/gmail.readonly'
];
$parameters = ['access_type' => 'offline'];
return Socialite::driver('google')->scopes($scopes)->with($parameters)->redirect();
like image 128
David Lemayian Avatar answered Jan 05 '23 19:01

David Lemayian