In my app i have 3 different ways to use Instagram Auth and need to redirect to 3 different places dependant on the action. because of this I have 3 different auth URL's
My registered redirect URL is http://nameoftheapp.com/folder/
Auth URL 1 is
https://api.instagram.com/oauth/authorize/?client_id='
+ ig_id
+ '&response_type=code&redirect_uri='
+ encodeURI('http://nameoftheapp.com/folder/?l=r');
Auth URL 2 is
https://api.instagram.com/oauth/authorize/?client_id='
+ ig_id
+'&response_type=code&redirect_uri='
+ encodeURI('http://nameoftheapp.com/folder/?l=g');
Auth URL 3 is
https://api.instagram.com/oauth/authorize/?client_id='
+ ig_id
+'&response_type=code&redirect_uri='
+ encodeURI('http://nameoftheapp.com/folder/?l=l');
Now all of these URL's return me to the correct URL with the code appended to it ready to turn into an access token.
Without the parameters inside the EncodeURI this lets me access the data I need. If I keep the paramters I get the HTTP400 error below
[23-Aug-2014 10:26:40 Europe/Berlin] Array
(
[code] => 400
[error_type] => OAuthException
[error_message] => Redirect URI doesn't match original redirect URI
)
If you look at this page on Instagrams documentation it says it allows you to use parameters http://instagram.com/developer/authentication/
I had the same problem getting the access token by PHP, I issue that using the same URL of redirect_uri, for example:
If the Auth URL using is http://nameoftheapp.com/folder/?l=l after login in Instagram sends you to redirect_uri http://nameoftheapp.com/folder/?l=l&code=<CODE>. So in this file on the CURL parameters to get information or access token from Instagram use the same URL http://nameoftheapp.com/folder/?l=l with the same GET vars.
I know this is a old Post but this may be can helpful to sometone like me that ends in this post searching an answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With