-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig-google.php
More file actions
25 lines (23 loc) · 813 Bytes
/
Copy pathconfig-google.php
File metadata and controls
25 lines (23 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
$google = null;
function google($offline = true)
{
global $google;
if (!$google) {
$google = new Google\client();
$google->setApplicationName('Client_Library_Examples');
$google->setDeveloperKey(CONFIG['google']['key']);
$google->setClientId(CONFIG['google']['client']);
$google->setClientSecret(CONFIG['google']['secret']);
$google->set_offline($offline)
->set_scope([
'https://www.googleapis.com/auth/youtube.readonly',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/youtube.force-ssl',
])
->setRedirectUri('http://' . $_SERVER['HTTP_HOST'] . '/google/callback');
}
return $google;
}