Search code examples
oauth-2.0instagram

Instagram oauth api gives { "code": 400, "error_type": "OAuthException", "error_message": "No matching code found." }


I am working on an application that integrates with Instagram API to access the user information. I successfully fetch the Access Token using the authorize url but unable to fetch the userId using access_token url:

i am tried both the endpoints:

https://api.instagram.com/oauth/access_token?client_id=48275564e2c445f6b8e1356djfha3e0c&client_secret=ab2062da9f314e3489dke7ae9cbe6e5d&redirect_uri=http://localhost&grant_type=authorization_code

https://api.instagram.com/oauth/access_token

with the post body as:

client_id=48275564e2c445f6b8e1356djfha3e0c&client_secret=ab2062da9f314e3489dke7ae9cbe6e5d&redirect_uri=http://localhost&grant_type=authorization_code&code=1351860224.4827556.5dc92c4d15ea4a4ea1b0d33eaf0eef19

(The data in the request is modified), But i am getting the follwing

{
    "code": 400,
    "error_type": "OAuthException",
    "error_message": "No matching code found."
}

I have seen tons of queries and questions but could not find any solution to the problem.

The couple of questions i have is:

1) is the field code in the URL is same as access_token, if not how could i get the code field's value.

2) is there any other mechanism(API) to fetch the user details given the username is not known.

Please help me as i am completely stuck and running out my deadlines.


Solution

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