Posts under category Meta & Facebook

Hello everyone,
I'm currently experiencing an issue with the Facebook Graph API when querying the /me/accounts endpoint. Despite having a valid access token and all the necessary scopes, the data array in the response remains empty.
Here’s an overview of the situation:
API Request:
curl -i -X GET \
"https://graph.facebook.com/v20.0/me/accounts?fields=id%2Cname%2Caccess_token&access_token="
Access Token Info:
{
"perms": [
"publish_video",
"pages_manage_cta",
"pages_manage_instant_articles",
"pages_show_list",
"read_page_mailboxes",
"ads_management",
"ads_read",
"business_management",
"pages_messaging",
"pages_messaging_subscriptions",
"instagram_basic",
"instagram_manage_comments",
"instagram_manage_insights",
"instagram_content_publish",
"page_events",
"pages_read_engagement",
"pages_manage_metadata",
"pages_read_user_content",
"pages_manage_ads",
"pages_manage_posts",
"pages_manage_engagement",
"instagram_manage_events",
"manage_app_solution",
"public_profile"
],
"user_id": "",
"app_id":
}
API Response:
{
"data": []
}
I have verified that: - The access token is valid and includes all the necessary scopes (e.g., pages_show_list, pages_manage_metadata, etc.). - The user associated with the access token does indeed manage Facebook Pages. - The app is in live mode and all necessary permissions have been requested and approved. - I've tried debugging using the Graph API Explorer, but the result remains the same: the data array is always empty.
Potential Cause:
I came across this documentation about "Tech Providers" and suspect that it could be related to restrictions placed on tech providers accessing data on behalf of clients. However, it's unclear if these restrictions are causing the empty data response or if something else might be at play.
My Question:
Could these tech provider restrictions be the reason for the empty response?
Is there something specific I need to verify or modify in the app settings related to these restrictions?
Are there any additional steps I should take to ensure access to the pages data through the API?
Any insights or guidance on how to resolve this issue would be greatly appreciated.
Thank you!

I'm creating an automation flow with puppeteer to log in to Facebook and get the User Access Token. The code is a NodeJS code and pretty simple for now:

require("dotenv").config(); const { tagmanager } = require("googleapis/build/src/apis/tagmanager"); const puppeteer = require("puppeteer"); (async () => {   // Lança o navegador com a UI visível para que possamos acompanhar o processo   const browser = await puppeteer.launch({ headless: false });   const page = await browser.newPage();   // Define a URL para o fluxo de login do Facebook   const facebookLoginURL = `https://www.facebook.com/v16.0/dialog/oauth?client_id=${process.env.FB_APP_ID}&redirect_uri=${process.env.FB_REDIRECT_URI}&scope=email,public_profile&response_type=code`;   // Vai para a página de login do Facebook   await page.goto(facebookLoginURL);   // Espera o span com o texto específico "Permitir todos os cookies"   await page.waitForFunction(() => {     const elements = Array.from(document.querySelectorAll("span"));     // Verifica se algum elemento contém o texto "Permitir todos os cookies"     const targetElement = elements.find(       (element) => element.textContent.trim() === "Permitir todos os cookies"     );     // Se o elemento for encontrado, retorna true para sair do loop     if (targetElement) {       return true;     }     // Continua o loop se não encontrar o elemento     return false;   });   // Encontra e clica diretamente com page.click()   await page.evaluate(() => {     const elements = Array.from(document.querySelectorAll("span"));     // Verifica se algum elemento contém o texto "Permitir todos os cookies"     const targetElement = elements.find(       (element) => element.textContent.trim() === "Permitir todos os cookies"     );     if (targetElement) {       targetElement.setAttribute("id", "cookie-button"); // Atribui um ID temporário para garantir o seletor     }   });   await page.click("#cookie-button"); // Usa o seletor id para clicar diretamente   // Espera que o campo de email esteja disponível e preenche com o seu usuário de teste   await page.waitForSelector("#email");   await page.type("#email", process.env.FB_TEST_USER_EMAIL);   // Preenche a senha com a senha do usuário de teste   await page.type("#pass", process.env.FB_TEST_USER_PASSWORD);   // Clica no botão de login   await page.click('button[name="login"]');   // Espera o redirecionamento para a URL de callback   await page.waitForNavigation();   // Obtém a URL atual (que deve conter o código de autenticação)   const redirectedUrl = page.url();   console.log("Redirected URL:", redirectedUrl);   //here we need to handle 2FA   //...   // Extraia o código da URL de redirecionamento   const urlParams = new URLSearchParams(redirectedUrl.split("?")[1]);   const authCode = urlParams.get("code");   console.log(`Auth Code: ${authCode}`);   await browser.close(); })(); 

The puppeter code above comprises the following steps:

  1. Open Facebook login page (OK)

  2. Log in with user and password (OK)

  3. Enter 2FA code (not OK)

  4. Get User Access Token (not OK because of 3)

I'm having trouble with step 3, because I don't know how to get the code automatically, i.e. without having to enter it manually. Any solutions?

2FA is enabled in Meta Business Manager and I normally receive this code by SMS or via the Microsoft Authenticator app. I could perhaps disable 2FA for the user in question in the Meta Business Manager, but that's something I wouldn't want to do, as it reduces credibility on the Meta side, which could block the user.

So I'd like to "hear" from you about possible ways of dealing with this. Thanks in advance!

I want to handle with 2FA by using puppeteer to login on Facebook with a normal user account.

My ads account was suddenly deactivated for no reason. I haven't run a single ad in the last 5 years so it is not because of any ad or ad content. I need to run ads again. Here are some of the error messages I am getting: "Your account is restricted right now: You have been temporarily blocked from performing this action. (#2859015)" and "You're Restricted From Advertising. You can't run ads or manage ad accounts." I have submitted over 20 support tickets with no helpful responses from Meta - all form responses and telling me my account actually is active, which it is not. My payment method is valid, I just successfully loaded $1.00 onto the account. Can anyone direct me to someone who can help reactivate my account?