// BLIMSKETCH DOODLE PAD include_once('/home/sites/blims/htdocs/includes/Classes.php'); ini_set("session.cookie_domain",".".$cookiedomain); $app_name = 'BLIMSKETCH'; $client_id = 'sHUQdDmAmbjxBpAZaExMfGwgjZNcvBDz'; $client_secret = '43bAV3w5LzZ6Bf8XSMdbcFJWfC4xWjt7'; $blims_client_id = 'EJzjVeZCWKKqTSHAAVguXC6xN9aaUJHX'; $blims_app_key = '0c92eaa020927dd2d95718dde7940d76'; $redirect_uri = 'https://bli.ms/ketch/'; $scopes = 'files,public_messages,basic,follow,stream,write_post,update_profile'; //$Session = new Session; session_start(); if(isset($_GET['logout'])){ session_destroy(); header('Location: '.$redirect_uri); exit; } $action = "new"; function showConnect(){ global $client_id, $scopes; // html head include_once('template/head.php'); echo '
'; //echo $data; //echo ''; return $data; } if(!isset($_SESSION[$app_name]['access_token'])){ if(isset($_GET['code'])){ $code = $_GET['code']; $details = Array(); $details['client_id'] = $client_id; $details['client_secret'] = $client_secret; $details['grant_type'] = 'authorization_code'; $details['redirect_uri'] = $redirect_uri; $details['code'] = $code; // get the access token $at = curly('https://account.app.net/oauth/access_token','','',$details); //echo $at; $adn = json_decode($at); $adn_access_token = $adn->access_token; $adn_username = $adn->username; $adn_user_id = $adn->user_id; //echo 'access_token:
'; //print_r($adn); //echo ''; //exit; /* curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer '.base64_encode($client_id.":".$client_secret), 'Identity-Delegate-Token: '.$delegate_token ) */ //$header = array('Authorization: Bearer '.$adn_access_token); //$details = Array(); //$details['grant_type'] = 'delegate'; //$details['delegate_client_id'] = $client_id; $del = json_decode(getDelegateToken($adn_access_token, $blims_client_id)); $_SESSION[$app_name]['access_token'] = $adn_access_token; $_SESSION[$app_name]['adn_username'] = $adn_username; $_SESSION[$app_name]['adn_user_id'] = $adn_user_id; $_SESSION[$app_name]['delegate_token'] = $del->delegate_token; //echo $adn_access_token.'
'; //print_r($del); //echo ''; header('Location: '.$redirect_uri); exit; } else { showConnect(); //header('Location: /'); } } // html head include_once('template/head.php'); ?>