Everything you need to connect your real Facebook Page posts to the homepage in under 20 minutes.
The homepage section calls the Facebook Graph API directly from the visitor's browser using your Page Access Token. It fetches your latest posts and renders them in the same card carousel design.
Your Page ID is the numeric identifier Facebook uses for your Page (e.g. 123456789012345).
Alternative method: Go to lookup-id.com, paste your Facebook Page URL, and it will show your numeric Page ID instantly.
You need a free Developer App to generate tokens. This takes about 5 minutes.
Note: Your app will start in Development mode. That is perfectly fine for reading your own Page's public posts.
Use the Graph API Explorer — the easiest tool for getting a token quickly.
pages_read_engagement — read post content & photospages_show_list — list your PagesOpen index.html in a code editor. Search for FB_CONFIG near the bottom of the file (just before </body>). You'll see:
var FB_CONFIG = {
pageId : 'YOUR_PAGE_ID', /* <- Replace this */
token : 'YOUR_ACCESS_TOKEN', /* <- Replace this */
pageUrl : 'https://www.facebook.com/share/1ErTQWb5hF/',
limit : 10,
refresh : 15 * 60 * 1000
};
Replace the two placeholder values:
var FB_CONFIG = {
pageId : '123456789012345', /* Your numeric Page ID */
token : 'EAAxxxxxxxxxx...', /* Your Page Access Token */
pageUrl : 'https://www.facebook.com/share/1ErTQWb5hF/',
limit : 10,
refresh : 15 * 60 * 1000
};
Save the file, then commit and push to GitHub. The live feed will appear immediately on the website.
The token from the Graph Explorer lasts only 1 hour. Exchange it for a 60-day token using this URL in your browser:
https://graph.facebook.com/v19.0/oauth/access_token
?grant_type=fb_exchange_token
&client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&fb_exchange_token=YOUR_SHORT_LIVED_TOKEN
Where to find your App ID and App Secret:
Paste the full URL (with your values filled in) into your browser's address bar and press Enter. The response will be JSON containing a access_token value — that's your 60-day token. Replace the value in index.html with this new token.
⚠ Remember: 60-day tokens still expire. Set a calendar reminder to refresh the token every 50 days, or use the permanent System User token method in Step 6.
A System User Access Token from Facebook Business Manager never expires — you set it once and forget it.
pages_read_engagementpages_show_listtoken in FB_CONFIG. It will never expire.If you don't have a Business Manager account: Use the 60-day token from Step 5 and refresh it every 50 days.
| Permission | Why it's needed | Sensitive? |
|---|---|---|
pages_read_engagement |
Read the posts, photos, and content on your Page | No |
pages_show_list |
Required to obtain a Page-scoped token | No |
You do not need publish_pages, ads_management, or any other elevated permissions. The feed is read-only.
Since your Facebook Page posts are already public, the data being accessed is not private. The token simply proves you authorise this app to read your public Page on your behalf.
refresh: 15 * 60 * 1000 in FB_CONFIG (value is milliseconds).limit: 10 (maximum Facebook allows is 100).| Symptom | Likely cause | Fix |
|---|---|---|
| Portfolio images show instead of Facebook posts | Token or Page ID not yet set, or token expired | Check that pageId and token in FB_CONFIG are filled in correctly. Refresh the token if expired. |
| Skeleton shimmer cards never disappear | JavaScript error or ad-blocker blocking graph.facebook.com | Open browser DevTools → Console tab and look for errors. Disable ad-blocker to test. |
| Error "Invalid OAuth access token" | Token is expired or malformed | Generate a new token following Steps 3–5 above. |
| Error "Unsupported get request" or "Object does not exist" | Page ID is incorrect | Double-check the numeric Page ID from Step 1. Do not use the Page's vanity name — use the number. |
| Feed shows but images are broken | Facebook CDN images have CORS or privacy restrictions | Ensure posts are set to Public audience on Facebook. Private/Friends posts won't have publicly accessible images. |
| Token works today but breaks after 60 days | Using a short-lived or 60-day token | Switch to a System User token (Step 6) which never expires. |
Facebook Graph API Explorer for testing:
You can test your token and Page ID directly at developers.facebook.com/tools/explorer. Run this query to verify:
GET /{YOUR_PAGE_ID}/posts?fields=id,message,full_picture,permalink_url&limit=5
If you see posts returned, the setup is correct. If you see an error, the token or Page ID needs fixing.
This guide is for the Motion Plus Corporation website internal use.
Facebook Graph API documentation: developers.facebook.com/docs/graph-api