Dessa
Dessa

Reputation: 237

Error in OAuthException in Instagram API

{"code": 400, "error_type": "OAuthException", "error_message": "Redirect URI does not match registered redirect URI"}

I already have client id and secret id. My redirect url is http://localhost. And I also obtained curlhttpclient.php, instagram.php, and example.php from macuenca in github. I modified the example.php and replaced client id, secret, id, and redirect url with mine. But everytime i run the example.php, i get this error.

Upvotes: 0

Views: 577

Answers (2)

hdkhardik
hdkhardik

Reputation: 662

Your redirect URL must be absolute URL i.e. something like

http://localhost/callback.php

and then make an authentication call from this page itself i.e callback.php, otherwise it will not let you to fetch access token, as well pass the complete URL in redirect_url filed

Upvotes: 0

Trent Lloyd
Trent Lloyd

Reputation: 1892

When you register with Instragram to get your OAuth client_id and client_secret OAuth, you register the URL you intend to redirect to after authentication. That is not matching the URL you are using (localhost).

Likely either you need to

(a) Update your instagram registration, or (b) You are using someone elses secret token, so register your own

More information: https://instagram.com/developer/authentication/?hl=en https://instagram.com/developer/register/

Upvotes: 1

Related Questions