'; echo '


Sketch a doodle in the browser and share it to App.net!

Get started!





Built by @kosso

Powered by bli.ms and app.net
'; include_once('template/footer.php'); echo '
'; include_once('template/foot.php'); exit; } function getDelegateToken($access_token, $delegate_client_id){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://alpha.app.net/oauth/access_token"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '.$access_token)); $params = array('grant_type' => 'delegate', 'delegate_client_id' => $delegate_client_id); $p = http_build_query($params); curl_setopt($ch, CURLOPT_POSTFIELDS, $p); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $data = curl_exec($ch); curl_close($ch); if(!$data){ echo 'error'; } //$response = json_decode($data); //logIt('APPNET REPLY : '.$data); //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.'
'; //echo 'delegate_token:
';
		//print_r($del);
		//echo '
'; header('Location: '.$redirect_uri); exit; } else { showConnect(); //header('Location: /'); } } // html head include_once('template/head.php'); ?>