How to...

get an Instragram access token

With many websites you might want to integrate your Instagram account with your website so that you can show your most recent posts. Most platforms that dish out API Keys to their users usually make this a pretty easy and painless process, but not Instagram. If you need an access token or API key for your Instagram account read on! 

  1. Log into the Instagram account you want to integrate with your site
  2. Visit https://www.instagram.com/developer/
  3. From here you will need to 'Register' your application.
  4. Follow the steps shown, then click 'Manage Clients' and 'Register a New Client'
  5. Complete all the fields.
  6. Once created, untick the 'Disable implicit...' checkbox on the Security tab.
  7. Once you have done this you will then need to generate an 'access token'. This is the not so obvious part of the process. Visit this url https://www.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT_URI&response_type=token replacing the CLIENT_ID with the client id you have just created in Instagram and REDIRECT_URI with the website url you have just entered in whilst creating this client.
  8. You will then be asked to authorize the application, click 'authorize'
  9. You will now be redirected to your website and the access token will be present in the URL. This is a very long string of numbers and letters and  will look similar to http://yourwebsite.com/#access_token=123456789.76543a1.e11abc123a1234567ab12345a12b1234
  10. Copy and save the access code into your website's CMS in the appropriate section.

After doing this, you may receive an error like:

"Sorry, an error occurs from Instagram API: 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."

To rectify this (whilst logged into the Instagram account) go to:

https://www.instagram.com/oauth/authorize/?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=public_content

Replacing the CLIENT_ID and REDIRECT_URI with the appropriate values.

Easy! (when you know how...)