google drive: set access type to 'offline' when requesting token

We need to do this in order to be able to refresh the access token without
prompting the user for their credentials every hour. This was the default
in 0.6 of the Google library, but needs to be explicitly specified in 1.0.
This commit is contained in:
Adam Williamson 2014-02-04 23:19:33 -08:00
parent 18707f5aba
commit 61d70b17ee
1 changed files with 1 additions and 0 deletions

View File

@ -14,6 +14,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
$client->setClientSecret($_POST['client_secret']); $client->setClientSecret($_POST['client_secret']);
$client->setRedirectUri($_POST['redirect']); $client->setRedirectUri($_POST['redirect']);
$client->setScopes(array('https://www.googleapis.com/auth/drive')); $client->setScopes(array('https://www.googleapis.com/auth/drive'));
$client->setAccessType('offline');
if (isset($_POST['step'])) { if (isset($_POST['step'])) {
$step = $_POST['step']; $step = $_POST['step'];
if ($step == 1) { if ($step == 1) {