kinlane
9/5/2012 - 10:18 PM

Github Login Using Singly

Github Login Using Singly

$Github_Code = $_REQUEST['code']

// Base Authentication URL
$url = "https://api.singly.com/oauth/access_token";	 

// Create an Array to POST
$data = array(
    'client_id' => $this->Singly_Client_ID,
    'client_secret' => $this->Singly_Client_Secret,
    'code' => $Github_Code
);	

// Setup curl
$curl_handle = curl_init();  
curl_setopt($curl_handle, CURLOPT_URL, $url);  
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl_handle, CURLOPT_POST, true);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);

// Execute
$output = curl_exec($curl_handle);
$info = curl_getinfo($curl_handle);

// Create array from JSON
$auth = json_decode($output)