Skip to content

Connect Facebook Ads Credentials

Use this guide to connect OWOX Data Marts to the Facebook Ads API.

You can connect in two ways:

  1. OAuth: use this method when Continue with Facebook appears.
  2. 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.

  1. Click Continue with Facebook in the connector settings.
  2. Log in with a Facebook account that can access the ad account, then confirm access. The button shows Authenticated as… after a successful login.
  3. 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.

OWOX Facebook connector settings showing the Continue with Facebook button and the Account ID field

Next, open Configure Data Import and choose the data you want to fetch. See Configure Data Import.

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 curl for 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”
  1. Visit Meta for Developers.
  2. Log in with your Facebook account.
  3. Go to My Apps.
  4. Click Create App.
  5. Enter an App Name, for example OWOX Data Marts App.

Meta for Developers My Apps page with the Create App button

Create App form with the App Name field filled in

  1. In Use Cases, open the Filter by panel.
  2. Select All to list every use case.
  3. Choose Measure ad performance data with Marketing API.
  4. Connect your Business Portfolio.
  5. Leave the other fields as default.
  6. 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.

App creation use-case step with "Measure ad performance data with Marketing API" selected and a Business Portfolio connected

Step 2: Get the App Credentials and Authorization Code

Section titled “Step 2: Get the App Credentials and Authorization Code”
  1. Open your new app.
  2. Go to App Settings → Basic.
  3. Copy your App ID.
  4. Copy your App Secret.

App Settings Basic page showing the App ID and App Secret fields

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_read covers 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_management covers 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_auth

The state value helps check this authorization request. You can keep owox_fb_auth or replace it with random text.

  1. Replace YOUR_APP_ID in the authorization URL.
  2. Open the URL in your browser.
  3. Confirm that you use the right Facebook account.
  4. Click Continue as… or Connect.
  5. Click Save.
  6. Click Got it.

Facebook authorization dialog in the browser with the Continue and Save buttons

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 the code from the address bar. The localhost link does not open a real site.

Browser address bar showing the code parameter on a "This site can't be reached" page

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_token

Open 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_STEP

The & 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.

API client POST request to the Facebook oauth/access_token endpoint API client Body tab set to form-encoded with client_id, client_secret, redirect_uri, and code parameters API client request with all body parameters filled in before sending

Click Send. The response contains your Access Token.

API client response panel showing the returned access_token value

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.

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.

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:

API client request highlighting the correctly formatted redirect_uri value http://localhost/

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.

If you run into other issues:

  1. Check Troubleshooting Facebook Ads imports for Data Mart run, permission, and account access errors.
  2. Search Q&A.
  3. Open an issue to report a bug.
  4. Join the discussion forum.