Your portfolio now automatically fetches your latest Instagram posts! No more manual updates needed.
-
Go to Facebook Developers:
- Visit: https://developers.facebook.com/
- Click "My Apps" β "Create App"
-
Choose App Type:
- Select "Business" (required for Instagram API)
- App name: "Your Portfolio Instagram Feed"
- Contact email: your email
-
Add Instagram API with Instagram Login:
- In your app dashboard, click "Add Product"
- Find "Instagram API with Instagram Login" β "Set Up"
-
Configure Business Login for Instagram:
- Go to "Instagram" β "API setup with Instagram login"
- Add your redirect URI:
https://yourdomain.com/ - Add deauthorize callback:
https://yourdomain.com/ - Add data deletion request URL:
https://yourdomain.com/
-
Get Instagram App Credentials:
- Note your Instagram App ID (different from Facebook App ID)
- Note your Instagram App Secret
-
Instagram Professional Account Required:
- Your Instagram account must be a Business or Creator account
- Personal accounts won't work with this API
-
Authorization URL (replace YOUR_INSTAGRAM_APP_ID):
https://api.instagram.com/oauth/authorize ?client_id=YOUR_INSTAGRAM_APP_ID &redirect_uri=https://yourdomain.com/ &scope=instagram_business_basic,instagram_business_content_publish &response_type=code -
Visit the URL β Login with Instagram β Copy the code from redirect
-
Exchange Code for Token (use terminal/Postman):
curl -X POST https://api.instagram.com/oauth/access_token \ -F client_id=YOUR_INSTAGRAM_APP_ID \ -F client_secret=YOUR_INSTAGRAM_APP_SECRET \ -F grant_type=authorization_code \ -F redirect_uri=https://yourdomain.com/ \ -F code=AUTHORIZATION_CODE_FROM_STEP_2
-
Get Long-Lived Token (60 days):
curl -i -X GET "https://graph.instagram.com/access_token ?grant_type=ig_exchange_token &client_secret=YOUR_INSTAGRAM_APP_SECRET &access_token=SHORT_LIVED_TOKEN"
-
Update
.envfile:VITE_INSTAGRAM_ACCESS_TOKEN=your_long_lived_token_here VITE_INSTAGRAM_USER_ID=your_instagram_user_id_here
-
Get Your Instagram User ID:
curl -i -X GET "https://graph.instagram.com/me?fields=id,username&access_token=YOUR_ACCESS_TOKEN" -
Restart Development Server:
npm run dev
-
Go to Repository Settings:
- GitHub repo β Settings β Secrets and variables β Actions
-
Add Repository Secrets:
VITE_INSTAGRAM_ACCESS_TOKEN: Your Instagram tokenVITE_INSTAGRAM_USER_ID: Your Instagram user ID
-
Update GitHub Actions (
.github/workflows/deploy.yml):- name: Build run: npm run build env: VITE_INSTAGRAM_ACCESS_TOKEN: ${{ secrets.VITE_INSTAGRAM_ACCESS_TOKEN }} VITE_INSTAGRAM_USER_ID: ${{ secrets.VITE_INSTAGRAM_USER_ID }}
- Add environment variables in your hosting platform's dashboard
- Fetches latest 12 Instagram posts
- Updates every 30 minutes automatically
- Manual refresh button available
- Actual post captions
- Real timestamps
- Media URLs and permalinks
- Direct links to Instagram posts
- Shows demo content if API fails
- Error messages for debugging
- Graceful degradation
Your tokens expire every 60 days. You'll need to regenerate them periodically.
// Check token validity in browser console
fetch(`https://graph.instagram.com/me?fields=id&access_token=YOUR_TOKEN`)
.then(r => r.json())
.then(console.log);The new API supports programmatic token refresh for long-lived tokens.
-
Business/Creator Account Required:
- Your Instagram must be a Business or Creator account
- Personal accounts no longer supported
-
New API Endpoints:
- Base URL:
https://graph.instagram.com/ - Different permission scopes required
- Base URL:
-
Advanced Access Needed for Production:
- Standard Access: Only works for accounts you own/manage
- Advanced Access: Required for public use (needs App Review)
-
New Permission Scopes:
instagram_business_basic(replaces old scopes)instagram_business_content_publish
Standard Access (Good for personal portfolios):
- Works for your own Instagram accounts
- No app review required
- Limited to accounts you manage
Advanced Access (For client work):
- Works for any Instagram Business/Creator account
- Requires Meta App Review process
- Business verification needed
In HobbiesSection.tsx, modify the API call:
`https://graph.instagram.com/me/media?fields=...&limit=12` // Change 12 to desired numberconst filteredPosts = data.data.filter((post: any) =>
post.media_type === 'IMAGE' // Only show images
// Remove this line to show videos too
);// Change 30 minutes to your preferred interval
const interval = setInterval(() => {
fetchInstagramPosts(true);
}, 30 * 60 * 1000); // 30 minutes in milliseconds- Never commit
.envfile (already in .gitignore) - Use repository secrets for deployment
- Regenerate tokens if compromised
- Monitor API usage in Facebook Developers dashboard
- Convert to Business/Creator account if using personal account
-
"Access token is invalid":
- Token expired β Generate new one
- Wrong token β Double-check .env file
- Using old Basic Display API token β Get new token with new API
-
"Instagram professional account required":
- Convert your Instagram to Business or Creator account
- Personal accounts no longer supported
-
"Insufficient permissions":
- Make sure you have
instagram_business_basicscope - Check if using correct Instagram App ID (not Facebook App ID)
- Make sure you have
-
CORS errors:
- New API endpoints should work from any domain
- Verify you're using
graph.instagram.comnotgraph.facebook.com
-
Rate limiting:
- New API has different rate limits
- Business Use Case rate limiting applies
Check browser console for detailed error messages and API responses.
If you want to use this for client work or public portfolios:
-
Business Verification Required:
- Submit business documents
- Verify your business identity
-
App Review Process:
- Submit app for
instagram_business_basicpermission - Provide app demonstration video
- Explain use case clearly
- Submit app for
-
Timeline:
- Business verification: 2-5 business days
- App review: 7-14 days
Test your setup:
- Development: http://localhost:8081/ β Check Hobbies section
- Console Logs: Should see "β Loaded X Instagram posts"
- API Response: Should include Business account data
- Real Data: Posts should match your Instagram Business profile
- New Instagram API Docs: https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login
- Migration Guide: https://developers.facebook.com/docs/instagram-platform/changelog
- Business Account Setup: https://business.instagram.com/getting-started
- Facebook Developers Support: https://developers.facebook.com/support/
If you previously used Basic Display API:
- Create new Instagram API app (different product)
- Convert Instagram to Business/Creator account
- Update authorization URLs and scopes
- Generate new access tokens
- Update API endpoints in your code
Your Instagram feed will now update automatically with the modern API! π