I am trying to access data related to a tag (let's call it "X") using Instagram API. I tried running it from Python and from the browser directly and got the same error:
{u'meta': {u'code': 400, u'error_type':u'OAuthPermissionsException', u'error_message': u'This request requires scope=public_content, but this access token is not authorized with this scope. The user must re-authorize your application with scope=public_content to be granted this permissions.'}}
This is the simple Python code I wrote in order to first make it work:
import requests access_token = 'zzzzzzzzzzzzz' parameters = {"q": "X", "scope": "public_content", "access_token": "zzzzzzzzzzzzz"} response = requests.get("https://api.instagram.com/v1/tags/search", params=parameters) insta_posts = response.json()
Am I using the right URL for a Sandbox? I read the Instagram API documentation and applications in Sandbox do not need any type of approval for a scope change.
Also, the application is authorized for Sandbox only:
Screen Capture of Application Defined in Instagram API
I figured out what was going on. One need to first change the scope of the authorization for the application. This is how I did it:
From your browser execute:
https://api.instagram.com/oauth/authorize/?client_id=CLIENTID&redirect_uri=REDIRECT-URI&response_type=code&scope=SCOPE
Just need to insert your data for the words in uppercase
Once that is done, the application is authorized for that scope.
As I had already the access token, I did not need to do steps 2 and 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With