Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Photo Browser iPhone App Connecting to an API using OAuth Connecting to Instagram

unable to authorize token within scope

I get this error when I run the app:

2016-02-09 23:39:46.188 Photo Bombers[25711:8367959] text: {"meta":{"error_type":"OAuthPermissionsException","code":400,"error_message":"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."}}

Any ideas on what the fix is?

1 Answer

Nathan Tallack
Nathan Tallack
22,160 Points

At a guess, the application that you have received the access token from doesn't allow the public_content scope to be accessed.

Be sure you are using the correct scope first. Consider making a call to set your scope first before you pass your token. Something like this would be what you are looking for maybe?

https://api.instagram.com/oauth/authorize/?client_id=CLIENTID&redirect_uri=REDIRECT-URI&response_type=code&scope=SCOPE