Search code examples
instagram-api

Instagram API calls not working with Client ID


I'm attempting to use Instagram's location search endpoint documented here: https://www.instagram.com/developer/endpoints/locations/

I've registered my app and gotten a client ID.

When I intentionally omit a client ID or access token and submit the following: https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351

I get:

{
  "meta": {
    "error_type": "OAuthParameterException",
    "code": 400,
    "error_message": "Missing client_id or access_token URL parameter."
  }
}

This makes sense, and tells me I should be able to use a client_id for this call (meaning users won't have to authenticate to Instagram).

However, when I append &client_id=VALID_CLIENT_ID

I get:

{
  "meta": {
    "error_type": "OAuthAccessTokenException",
    "code": 400,
    "error_message": "The access_token provided is invalid."
  }
}

Am I correct that I should be able to use this call without authenticating? If so, any thoughts on what I'm doing wrong?

Thanks!


Solution

  • According to the instagram OAuth 2.0 docs, you need an access_token in order to make authenticated requests.

    In order to get the access token, your service needs to redirect the user to instagram to have them log in. From here, instagram will redirect the user to a url of your choice once the user has granted you access with the access_token in the url string.

    The Instagram OAuth 2.0 docs has more details.

    Also, I guess I misread the question. Here's documentation from Instagram saying that client_id is no longer supported for endpoints:

    The Instagram API requires an access_token from authenticated users for each endpoint. We no longer support making requests using just the client_id.