Facebook credentials¶
Changed in version 2.0: Facebook now uses OAuth 2.0 authentication. You no longer need to manually generate access tokens.
Agoras needs the following OAuth app credentials from Facebook to access its API:
Client ID (App ID)
Client Secret (App Secret)
App ID
Object ID (User/Page ID)
Create a Facebook App¶
If you already have a Facebook App, skip to “Get App Credentials”.
Go to My Apps.
Click “Create App”.
Select app type (choose “Business” or “Other”).
Fill in the app name and contact email.
Get App Credentials¶
In your Facebook App dashboard, go to Settings > Basic.
Note your App ID (this is your
--app-id).Note your App Secret (click “Show” to reveal it - this is your
--client-secret).The App ID is also your Client ID (this is your
--client-id).
Get Object ID (User/Page ID)¶
You need the ID of the Facebook page or profile you want to post to. To find your Page ID:
Go to your Facebook page.
Note the page name from the URL (e.g.,
LuisDevelopsfromhttps://www.facebook.com/LuisDevelops).Use the Graph API Explorer to get the ID:
https://developers.facebook.com/tools/explorer/?method=GET&path={page_name}Click “Submit” and you’ll see a response like:
{ "name": "Luis Develops", "id": "ZZZZZZZ" }
The id field is your --object-id.
CI/CD Setup (Unattended Execution)¶
For CI/CD environments where interactive browser authorization isn’t possible, you can skip the authorize step entirely and provide all required credentials via environment variables.
Run
agoras facebook authorizelocally first to generate a refresh token (one-time setup)Extract the refresh token using the tokens utility command:
# First, list tokens to find the identifier (if you don't know it) agoras utils tokens list --platform facebook # Then view all stored credentials agoras utils tokens show --platform facebook --identifier {identifier}
Set all required environment variables in your CI/CD pipeline:
export FACEBOOK_OBJECT_ID="your_object_id" export FACEBOOK_CLIENT_ID="your_client_id" export FACEBOOK_CLIENT_SECRET="your_client_secret" export FACEBOOK_REFRESH_TOKEN="your_refresh_token_here"
Run Agoras actions directly without running
authorize. All credentials will be loaded from environment variables.
Note: For unattended execution, you must provide all required credentials. The refresh token alone is not sufficient - you also need client ID, client secret, and object ID as shown in the Platform Arguments and Environment Variables Reference documentation.
Agoras parameters¶
Facebook credential |
Agoras parameter |
|---|---|
Client ID (App ID) |
–client-id |
Client Secret (App Secret) |
–client-secret |
App ID |
–app-id |
Object ID (User/Page ID) |
–object-id |