Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

{"error_type": "OAuthException", "code": 400, "error_message": "Invalid redirect_uri"}

Tags:

php

api

instagram

Firstly, this is my Instagram URL after the login:

https://www.instagram.com/oauth/authorize?client_id=$MYCLİENTİD&redirect_uri=https://localhost:4000/İnstagram/Insta.php/&response_type=code&scope=user_profile,user_media

And this is the error that page shows me:

{"error_type": "OAuthException", "code": 400, "error_message": "Invalid redirect_uri"}

When I try to get user token from Instagram, I get that error.
I've tried to change the redirect_uri=(Valid OAuth Redirect URIs), but the error is the same as before.

like image 314
Oğuz Kurukaya Avatar asked Jan 26 '23 07:01

Oğuz Kurukaya


2 Answers

I could not find this documented anywhere, but through trial and error, I found that the redirect_uri had to:

  1. Use https
  2. Be publicly accessible (e.g. localhost and specifying a port number won't work)
  3. Not include parameters (I found they were getting stripped out, which would cause a redirect_uri mismatch when I later requested an access token)
like image 155
json Avatar answered Jan 28 '23 11:01

json


I had the same problem and I solved it as following:
I first went here: (remember to change your instagram app id in the below URL) https://developers.facebook.com/apps/your_instagram_app_id/instagram-basic-display/basic-display/

Then I set my Client OAuth Settings, Deauthorize and Data Deletion Requests as "https://localhost:3000/".

That worked for me.

like image 37
Roy Martinez Avatar answered Jan 28 '23 11:01

Roy Martinez