Search code examples
phpinstagram-api

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.


Solution

  • 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/