Originally created by Juan Alejandro Morais
Whoever is reading this, I pity you from the depths of my heart. But, you need to regenerate tokens almost every 2 months to put into Netlify so that builds succeed.
Steps for that, as taken from here:
** Disclaimer: ** These steps might not be clear, or not exactly working for everybody. Working on updated or automated steps right now. Progress is at oorestisime/gatsby-source-instagram#24 Any help on this side is greatly welcomed and appreciated!
- You need to have a Facebook page (I know... :/)
- Go to your site settings -> Instagram -> Login into your Instagram account
- Create a app
- Go to the Graph API Explorer
- Make sure you are using v7 as api version
- Select your facebook app
- Click "Generate Access Token"
- Add the following permissions (pages_manage_ads, pages_manage_metadata, pages_read_engagement, pages_read_user_content, pages_show_list, instagram_basic)
- Make a GET request at
me/accounts
- copy the access_token in the response (we call this temporary_token)
- click on the id to change the explorer url and append
?fields=instagram_business_account&access_token={access-token}
- save your
instagram_business_account.id
, this is your instagram_id
- Access Token Debugger:
- Paste your temporary_token and press "Debug"
- You should see this token now expires in 3 months
- Press "Extend Access Token" and press the new debug that appears next to the token
- You should see this token now never expires
- Copy this new token (we will call this access_token)
- Use this in your .env.development or .env.production as the value for INSTA_ACCESS_TOKEN
With these two information you can now use the plugin as:
{
resolve: `gatsby-source-instagram`,
options: {
username: username,
access_token: access_token,
instagram_id: instagram_id,
},
},