Exemple #1
0
 public static function createGoogleOauthClient(Config $config, $initialize_access_token = TRUE)
 {
     $client = new Google_Client();
     $client->setApplicationName("GitHubSync");
     $client->setAuthConfigFile($config->getAuthConfigFile());
     $client->setScopes(['https://www.googleapis.com/auth/gmail.modify']);
     $client->setRedirectUri('urn:ietf:wg:oauth:2.0:oob');
     $client->setAccessType('offline');
     if ($initialize_access_token) {
         $access_token = $config->getGoogleAccessToken();
         if (!empty($access_token)) {
             $client->setAccessToken($access_token);
         }
     }
     return $client;
 }
Exemple #2
0
 protected function getClient()
 {
     $gh = new \Github\Client();
     $gh->authenticate($this->config->get('github.token'), \Github\Client::AUTH_HTTP_TOKEN);
     return $gh;
 }