Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (26 sloc) 839 Bytes
// This file should be the one's URL you give to Github as a callback
$code = $_REQUEST['code'];
$client_id = 'da931d37076424f332ef';
$client_secret = 'YOUR_SECRET_HERE';
if($code) {
$ch = curl_init('');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "client_id=$client_id&client_secret=$client_secret&code=$code");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
if(preg_match('/access_token=([0-9a-f]+)/', $response, $matches)) {
$token = $matches[1];
opener.gist.oauth[1]('<?= $token ?>');
Jump to Line
Something went wrong with that request. Please try again.