Meta auth
Setup (app, redirect page, environment): setup.
Steps
- Check what is connected:
node scripts/auth.mjs --platform facebook --status(and--platform threads). Instagram uses the facebook sign-in. - If not connected, run
node scripts/auth.mjs --platform <facebook|threads> --startand give the user thesignInUrl. Ask them to sign in and paste back the full URL of the page they land on. - Finish:
node scripts/auth.mjs --platform <facebook|threads> --finish --url "<pasted URL>" - Report the connected Pages (with
canPost), linked Instagram accounts, or the Threads user and expiry.
Rules
- Never print or paste tokens or the app secret. The pasted redirect URL is single-use.
- A Page with
canPost: falseneeds the user to get a content role on that Page. - No Instagram listed under a Page: the Instagram account is personal or not linked.
Failure handling
META_AUTH_STATE: the URL is from an older attempt; start again.META_AUTH_EXCHANGE: the redirect URI does not exactly match the app settings, or the app ID/secret pair is wrong (Threads has its own pair).THREADS_TOKEN_EXPIRED: sign in again; expired tokens cannot be refreshed.
