[ACCEPTED]-Instagram oauth api gives { "code": 400, "error_type": "OAuthException", "error_message": "No matching code found." }-instagram

Accepted answer
Score: 12

For me unchecking Disable implicit OAuth in instagram developer 1 -> manage clients fixed the issue

Score: 3

I found that using either form-data or application/x-www-form-urlencoded works fine. The 6 most important is the code you get from redirect 5 uri is only used by one request. It means 4 you could request the access token once for 3 the code. If the you request more than one time 2 with same code, you'll get the error like this:

    code: 400,
    error_type: "OAuthException",
    error_message: "Matching code was not found or was already used."

Wish 1 you all the best ;)

Score: 0

Try to urlEncode the redirect_uri param 4 to


And your code param contains the "." character 3 which might be a error.


might caused the 2 problem

"error_message": "No matching code found."

"5dc92c4d15ea4a4ea1b0d33eaf0eef19" seems 1 to be the correct code

Score: 0

I got same error. It seems that instagram's 9 spam system disable user's access to any 8 non-official application. Just change user's 7 password. In my case it was help. Also try 6 create another application.


From my answer to another question

It looks like 5 users get more than one code, and you see first code, but 4 need second. Try relogin users, if you gets error. User 3 will not see instagram page with confirm 2 button, just redirections.

Possible algorithm 1 of error:

1. User click auth link.
2. Get first code.
3. User click auth link (twice, redirection problem, public auth system, etc.)
4. Get another code (even on the same client_id, redirect_uri).
5. You get first code.
6. But first code already doesn't exists.
Score: 0

The problem is here that need redirect url 4 set as http://localhost/signin-instagram

signin-instagram part is very important So go to 3 Instagram.com/developer ->Manage Client-> Security 2 -> Valid redirect URIs set with that 1 end http:/../signin-instagram

Score: 0

Off late instagram python snippet fails 3 due to missing content-type HTTP header

response, content = http_object.request(url, method="POST", body=data,headers = {"Content-type": "application/x-www-form-urlencoded"})

adding 2 application/x-www-form-urlencoded worked 1 for me

Score: 0

I will mention what worked for me.

Step 1. Generate 6 a new client secret from you panel.

Step 2. Follow 5 the step 1 mentioned here to obtain the code 4 again.

Step 3. Send the request again with the 3 changed parameters.

Make sure you are logged 2 in the browser when you send the request. You 1 will get the required response.

Score: 0
  1. Go into Facebook for Developers > Your app. Click on "Roles" and add an Instagram test-account under "Instagram Testers".
  2. Log into instagram.com and go to: Settings > Security > Apps and Websites, where you will accept the test invitation.
  3. Prepare your URL link, which you will paste into the web browser. Make sure to use a valid redirect URI from "Valid OAuth Redirect URIs" from the Instagram Basic Display settings.
  4. If you did everything right, the Instagram tester account for the app, will have the option to gain access to user_profile,user_media. Continue the process to get the code which you can exchange for a short-lived access token.


More Related questions