A Pen by Dominic Pascal on CodePen.
Using the instafeed.js library: https://github.com/stevenschobert/instafeed.js
- Facebook Developer Account
- Public Instagram account with image posts
- Heroku acount (needed to setup access token service)
To connect to the API, you need to create a FB app with the "Instagram basic API" product and access token. The access tokens generated from instragram will expire, we will use a token service to make sure your tokens are refreshed and dont expire.
- Login into FB developer account at https://developers.facebook.com/apps/ and create a app
- During app setup, add the "Instagram Basic Display API" product
- In the "Basic Display API" setup add a "Instgram Tester" role
- Assign to the Instragram account you want to use for the feed (It needs to be a public account)
- After adding the test user login into https://www.instagram.com/accounts/manage_access/ with that account and select the "Test Invites" tab and accept
- Now return to the FB app sectup and scroll down to the "User Token Generator" section and clck "generate token"
- This is your access token thats needed to authenticate with the API
The service will be hosted on Heroku for free, go to https://heroku.com/deploy to create the service.
Check out this guide for more info: https://github.com/companionstudio/instagram-token-agent
Once the token service has been deployed you can check the status of the dynamic token here: https://{your-app-name}.herokuapp.com/. The access token can be accessed by js and json in the urls below:
- https://{your-app-name}.herokuapp.com/token.js
- https://{your-app-name}.herokuapp.com/token.json
Once you have your access token verified and working, you will need to update the below block in the JS.
<!-- access token service -->
<script src="https://{your-app-name-here}.herokuapp.com/token.js"></script>