示例#1
0
 private static function autenticateOAuth2()
 {
     $oauth = new OAuth2();
     $oauth->requestAuthentication($this->client_id, 'google.com');
 }
示例#2
0
文件: index.php 项目: sirnec/basecamp
$oauth = new OAuth2();
if (isset($_COOKIE['token'])) {
    $_SESSION['token'] = $_COOKIE['token'];
}
if (isset($_COOKIE['project_href'])) {
    $_SESSION['project_href'] = $_COOKIE['project_href'];
}
if (isset($_COOKIE['project'])) {
    $_SESSION['project'] = $_COOKIE['project'];
}
if (isset($_COOKIE['account_href'])) {
    $_SESSION['account_href'] = $_COOKIE['account_href'];
}
if (!isset($_GET['action'])) {
    if (!isset($_SESSION['token'])) {
        $oauth->requestAuthentication(array('user_id' => 10, 'project_id' => 20));
    }
    if (!isset($_SESSION['account_href'])) {
        getAccounts($_SESSION['token']);
    }
    if (!isset($_SESSION['project_href'])) {
        getProjects($_SESSION['account_href'], $_SESSION['token']);
    }
    getTodos($_SESSION['project'], $_SESSION['token']);
} else {
    switch ($_GET['action']) {
        case 'redirect':
            if (!isset($_GET['code'])) {
                throw new InvalidArgumentException("verification code missing");
            }
            $verification_code = $_GET['code'];