Example #1
0
            setcookie('username', $newUserName);
            header("Location: " . Config::getRootDomain());
            exit;
        } else {
            if ($operation == "getoauthtoken") {
                $code = $_GET['code'];
                $access_token = $_GET['access_token'];
                if (Config::getDebug()) {
                    $LOG->log("in getoauthtoken operation - code={$code} and access_token={$access_token}");
                }
            }
        }
    }
}
if (!empty($code) && empty($access_token)) {
    $url = "https://graph.facebook.com/oauth/access_token?client_id=" . Config::getFacebookConsumerKey() . "&redirect_uri=http://jittr.com/jittr/gameon/gologin.php?oauth=yes&client_secret=" . Config::getFacebookConsumerKeySecret() . "&code=" . $code;
    if (Config::getDebug()) {
        $LOG->log("In oauth flow for FB calling url = " . $url);
    }
    $curl = curl_init($url);
    $opts = Facebook::$CURL_OPTS;
    curl_setopt_array($curl, $opts);
    $result = curl_exec($curl);
    curl_close($curl);
    $oauth = $result;
    if (Config::getDebug()) {
        $LOG->log("In oauth flow for FB value of result= " . $oauth);
    }
    $url = "https://graph.facebook.com/me?" . $result;
    if (Config::getDebug()) {
        $LOG->log("Get FB user profile calling url = " . $url);