Skip to content

Commit

Permalink
Added support for offline access tokens.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmanos committed Oct 15, 2014
1 parent 484bf09 commit 98ebf6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'client_id' => '',
'client_secret' => '',
'scope' => array('userinfo_email', 'userinfo_profile'),
'offline' => false,
'fetch_user_info' => function ($service) {
$result = json_decode($service->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
return array(
Expand Down
8 changes: 8 additions & 0 deletions src/controllers/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public function getLogin($provider = null)

try {
$service = Social::service($provider);

if (Config::get('laravel-social::providers.' . strtolower($provider) . '.offline')) {
$service->setAccessType('offline');
}
} catch (Exception $e) {
App::abort(404);
}
Expand Down Expand Up @@ -389,6 +393,10 @@ public function getConnect($provider = null)

try {
$service = Social::service($provider);

if (Config::get('laravel-social::providers.' . strtolower($provider) . '.offline')) {
$service->setAccessType('offline');
}
} catch (Exception $e) {
App::abort(404);
}
Expand Down

0 comments on commit 98ebf6d

Please sign in to comment.