Connect Facebook Ads Credentials
Use this guide to connect OWOX Data Marts to the Facebook Ads API.
You can connect in two ways:
- OAuth: use this method when Continue with Facebook appears.
- Access Token: use this method for manual setup.
OAuth gives most users the shortest path. OWOX renews supported OAuth credentials while Meta keeps the grant valid. Manual setup requires a Meta app, an access token, an App ID, and an App Secret.
Self-hosted deployments: If the Continue with Facebook button is not available, use the Access Token method.
Before you start: Use a Facebook account with access to the target ad account. Accepted ad account roles: Admin, Advertiser, or Analyst. Without access, Meta returns empty results or a permission error.
- Click Continue with Facebook in the connector settings.
- Log in with a Facebook account that can access the ad account, then confirm access. The button shows Authenticated as… after a successful login.
- Enter the numeric Account ID. Do not include the
act_prefix. To import from multiple accounts, separate IDs with commas or semicolons.
See where to find Account IDs.
Reconnect with Facebook in these cases:
- The user revokes app access.
- Meta invalidates the grant.
- Required permissions change.
- The authorized user loses access to the ad account.
- The authorized user loses access to business assets.
Next, open Configure Data Import and choose the data you want to fetch. See Configure Data Import.
Access Token
Section titled “Access Token”Use this method when you need manual credentials. You will create a Meta app and get an access token. If you already used OAuth, skip this section — OAuth users do not need a manual access token.
Before you start: Step 3 sends your App Secret and authorization code, then receives your Access Token. Use Postman Desktop or
curlfor better security. If you use ReqBin, avoid shared computers. Do not save the request publicly. Delete the request or history after you copy the token.
Step 1: Sign In to the Meta for Developers Portal
Section titled “Step 1: Sign In to the Meta for Developers Portal”- Visit Meta for Developers.
- Log in with your Facebook account.
- Go to My Apps.
- Click Create App.
- Enter an App Name, for example
OWOX Data Marts App.
- In Use Cases, open the Filter by panel.
- Select All to list every use case.
- Choose Measure ad performance data with Marketing API.
- Connect your Business Portfolio.
- Leave the other fields as default.
- Click Create app on the final step.
No Business Portfolio yet? Pick Create a business portfolio here. You can also set one up at business.facebook.com. Meta requires it for Marketing API access.
Step 2: Get the App Credentials and Authorization Code
Section titled “Step 2: Get the App Credentials and Authorization Code”- Open your new app.
- Go to App Settings → Basic.
- Copy your App ID.
- Copy your App Secret.
Build the authorization URL from the template below. Replace only YOUR_APP_ID with your App ID.
OWOX requests both permissions because endpoints read different API areas:
ads_readcovers reporting endpoints: Ad Account Insights, its breakdown variants by Age and Gender, Country, Device Platform, Link URL Asset, Product ID, Publisher Platform and Position, and Region, plus Ad Insights by Ad Set and Ad Insights by Campaign.ads_managementcovers ad account and ad object endpoints: Ad Account, Ad Account User, Ad Account Ads, Ad Account Ad Creatives, and Ad Object (formerly Ad Group).
OWOX only reads data from these endpoints. The connector does not create or change ads. OWOX includes ads_management so the same token can read supported ad account and ad object data.
The URL requests both permissions in the scope parameter:
https://www.facebook.com/v25.0/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=http://localhost:8080/&response_type=code&scope=ads_read,ads_management&state=owox_fb_authThe state value helps check this authorization request. You can keep owox_fb_auth or replace it with random text.
- Replace
YOUR_APP_IDin the authorization URL. - Open the URL in your browser.
- Confirm that you use the right Facebook account.
- Click Continue as… or Connect.
- Click Save.
- Click Got it.
If Meta shows a redirect_uri error, see Troubleshooting Credential Setup.
After you authorize, the browser redirects to a URL that includes long code and state parameters. Check that the returned state value matches your authorization URL; if it does not match, stop and repeat Step 2. Then copy the code value — everything after code= and before &state=.... You need this code in the next step.
Note: You may see
This site can't be reached. This is expected. Copy thecodefrom the address bar. The localhost link does not open a real site.
Step 3: Generate and Save the Access Token
Section titled “Step 3: Generate and Save the Access Token”Exchange the authorization code for an Access Token using Postman Desktop, curl, or ReqBin.
Send a POST request to:
https://graph.facebook.com/v25.0/oauth/access_tokenOpen the Body tab and set the body type to x-www-form-urlencoded.
ReqBin: choose Form, then paste this body as one line. Replace the placeholder values first:
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&redirect_uri=http://localhost:8080/&code=CODE_FROM_THE_PREVIOUS_STEPThe & characters separate parameters. Do not add an extra & after the code value.
Postman Desktop: open Body → x-www-form-urlencoded and add separate rows for client_id, client_secret, redirect_uri, and code.
Click Send. The response contains your Access Token.
Copy the Access Token and store it securely. OWOX needs the Access Token, App ID, and App Secret to create a long-lived token.
Facebook access tokens can expire in about 60 days. OWOX uses the App ID and App Secret to exchange and refresh the token. If Meta invalidates the token or permissions change, repeat Steps 2-3.
Step 4: Use the Credentials
Section titled “Step 4: Use the Credentials”You now have the App ID, App Secret, and Access Token. OWOX needs all three credentials. Use them in the Data Mart setup, and follow Getting Started to fill in the connector fields.
Troubleshooting Credential Setup
Section titled “Troubleshooting Credential Setup”Use this section for access token and authorization code errors.
Error: This authorization code has been used
Section titled “Error: This authorization code has been used”Cause: You already exchanged this authorization code for an access token. Each code works only once.
Solution: Repeat Step 2 to generate a new temporary authorization code and try again.
Error: redirect_uri isn't an absolute URI. Check RFC 3986
Section titled “Error: redirect_uri isn't an absolute URI. Check RFC 3986”Cause: Your redirect_uri has the wrong format. Meta requires a valid absolute URI.
Solution: Check that your redirect_uri matches this format:
Example of a correct format:
http://localhost:8080/Error: This authorization code has expired
Section titled “Error: This authorization code has expired”Cause: The temporary authorization code expired. Facebook issues short-lived codes.
Solution: Repeat Step 2 to obtain a new temporary code and retry the request.
Error: redirect_uri mismatch or invalid redirect URI
Section titled “Error: redirect_uri mismatch or invalid redirect URI”Cause: Meta rejected the redirect URL used in the authorization request.
Solution: If your app has no Facebook Login product, add it from the app dashboard sidebar. Open Facebook Login → Settings, add http://localhost:8080/ as a Valid OAuth Redirect URI, then repeat Step 2.
Tip: Generate the authorization code and use it right away.
For errors after credentials are saved, see Troubleshooting Facebook Ads imports.
Support
Section titled “Support”If you run into other issues:
- Check Troubleshooting Facebook Ads imports for Data Mart run, permission, and account access errors.
- Search Q&A.
- Open an issue to report a bug.
- Join the discussion forum.