Search code examples
facebook-graph-apiauthorizationinstagraminstagram-apiclientcredential

Instagram API, fetching instagram images with client credentials instead of users access tokens


I need to show images from my Instagram business account to my website. I just need the last 5 images. I do not need other Instagram accounts and access tokens (I want to pull images with my user).

By documentation: https://developers.facebook.com/docs/instagram-api#instagram-graph-api

  • I created all Facebook apps
  • Created access token with the Instagram authorization window (do not want)
  • I am fetching images with user's access tokens (do not want)
  • Also I tried https://www.instagram.com/:name/?__a=1 but cors issue with images

Any idea how to pull images from Instagram without the Instagram authorization window on my website? Is it possible to create an access token with client credentials flow?


Solution

  • Using OAuth with the access tokens is the only way to pull content from Instagram. Instagram doesn't have a public API - if there were no authorization it would be a public API.

    What you need is a back-end service. Since you're only getting your own data, generate the access tokens and store them server side - a one time event. Create an endpoint to get the last 5 posts and server-side make the Instagram API call with the access tokens. The front-end will call the your new endpoint and display the posts.

    Another option is a paid social media aggregator.