Skip to content

Instantly share code, notes, and snippets.

@cosenary
Created April 6, 2015 10:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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