Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API: The access_token provided is invalid

I have registred a sandbox user. Now I am trying to use it, but I recieve "The access_token provided is invalid". Sample request:

https://api.instagram.com/v1/users/searchq=abc&count=2&client_id=7b67cff1a7ab462881298434c08b5ab8

It was working in live mode, but I can't find why it isn't working in sandbox.

like image 754
AndrewR Avatar asked Jun 03 '16 08:06

AndrewR


People also ask

Does Instagram API still work?

On the 29th of June, 2020, Instagram will stop using the old API (“Basic Permission”) to display photos from personal Instagram accounts to widgets. 3rd party apps using this, current API will no longer be able to display photos from your account if they don't switch to the new API after this date.


2 Answers

You need to check for requirements Scope for API you are using and if it's need and Authentications "Valid access Token". where also had some changes.

  • basic - to read a user’s profile info and media
  • public_content to read any public profile info and media on a user’s behalf
  • follower_list to read the list of followers and followed-by users
  • comments - to post and delete comments on a user’s behalf
  • relationships - to follow and unfollow accounts on a user’s behalf
  • likes - to like and unlike media on a user’s behalf

And take look about **Sandbox API behavior of your application not life yet :**

API Behavior

The behavior of the API when you are in sandbox mode is the same as when your app is live, but comes with the following restrictions:

Data is restricted to sandbox users and the 20 most recent media from each sandbox user Reduced API rate limits The first point is important and it means that the API behaves as if the only users on Instagram were your sandbox users, and the only media ever posted were the last 20 for each of these users.

For example, if you query the /users/{user-id}/ endpoint and the {user-id} is a sandbox user, then you will get the normal API response; but if the {user-id} is not a sandbox user, you will get a APINotFound error.

Good luck

like image 183
MR Gharibeh Avatar answered Sep 17 '22 06:09

MR Gharibeh


For me the access token Instagram generate is too short: they gave me something like this:

d2c387d768ec4d619306807c53bbf92b

it should be:

2940736713.1677ed0.31bb22b2b0f84befacc79c6afd025134

I used this site to generate it: http://instagram.pixelunion.net

like image 43
pinkp Avatar answered Sep 21 '22 06:09

pinkp