Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

How to give an ad tool Meta API access without sharing your login

Plenty of ad tools still ask you to log in with your personal Facebook account. That ties their access to one person, and when that person leaves the agency, everything breaks. Meta has a cleaner option for server-to-ser

Plenty of ad tools still ask you to log in with your personal Facebook account. That ties their access to one person, and when that person leaves the agency, everything breaks. Meta has a cleaner option for server-to-server access: a System User token that belongs to the Business Manager itself.

This is the setup I use for the Marketing API. You need admin rights on the Business Manager, and it takes about ten minutes.

Why a System User instead of a personal token

A System User is a non-human account inside Business Manager. Its token:

  • belongs to the business, not to an employee
  • only sees the assets you explicitly assign to it
  • can be revoked from Business Settings without touching anyone's personal login

If an ad account is not assigned to the System User, the API will not list it. That makes it easy to give a third-party tool exactly two accounts out of fifty.

1. Create or pick an app

Tokens are generated for an app. In Meta for Developers, go to My Apps and create or select an app owned by the same Business Manager. Add the Marketing API product to it.

2. Create the System User

Open Business Settings, then Users, then System users, and click Add. Name it after the tool that will use it, so you know later what to revoke. While you are in Business Settings, copy the Business Manager ID from Business info. Most tools ask for it to confirm the token really belongs to that business.

3. Assign only what the tool needs

Select the System User and choose Add assets. Assign:

  • the app from step 1
  • only the ad accounts the tool should see, with the permissions the work needs

This step is where most "my account is missing" problems come from later, so take a second to check the list.

4. Generate the token

Click Generate new token, pick your app and an expiry, and choose permissions:

  • ads_read and business_management cover reporting and discovering which accounts exist.
  • ads_management is only needed if the tool should apply changes. Leave it out for read-only reporting.

Copy the token once it is generated.

5. Hand it over safely

Paste the token straight into the tool's connection screen. Do not send it by email or chat, not even to the vendor's support team. A token in an inbox is a token you have to rotate.

To rotate later, generate a fresh token and replace the old one in the same field. A well-built tool keeps the old connection alive until the new token is verified.

Troubleshooting

"This System User does not belong to the Business Manager ID entered." You copied the ID from a different Business Manager than the one where you created the System User. Copy it again from the same place.

An ad account is missing. It is not assigned to the System User. Add it under Add assets, then refresh the account list in your tool.

Reporting works but changes fail. The token was generated without ads_management. Generate a new one with it.

Where this comes from

We wrote the original version of this guide for Ads Control Center, where a System User token is how the app connects to Meta. In our case the AI assistant drafts ad changes, a named person approves each one, and only then does the token with ads_management get used. The setup above works the same way for any tool that talks to the Marketing API.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.