Skip to content

Instantly share code, notes, and snippets.

@cosenary
Created April 6, 2015 10:07
Show Gist options
  • Save cosenary/f3114222d0492ce0acd4 to your computer and use it in GitHub Desktop.
Save cosenary/f3114222d0492ce0acd4 to your computer and use it in GitHub Desktop.
Instagram OAuth proxy
<?php
// Registered Instagram redirect URI: http://example.com/instagramproxy.php
// Custom YOUR_APP_CALLBACK redirect URI: http://example.com/instagramproxy.php?redirect=http://foo.com
// receive OAuth code parameter
$code = $_GET['code'];
$redirectHost = $_GET['redirect'];
$instagramEndpoint = $redirectHost . "/success.php?code=" . $code;
// authentication failed -> redirect to login
header('Location: ' . $instagramEndpoint);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment