Posts tagged with facebook-graph-api

I am facing the same problem as mentioned in this question, Why some ads is not breaking down by link_url_asset, the only difference is that I am pulling data on "Campaign" level.

Since the question was asked long back and there's no answer, so posting it again with my wrapper question.

When I am not applying breakdown, I am getting X number of impressions. But when I apply breakdown on link_url_asset, the breakdown happens but when I add the impressions, the sum does not match with X (less than X).

The reason I want to do breakdown is because I want to pull the utm_campaign value from the website_url attribute in link_url_asset.

I am hitting following endpoint with the params -

/GET https://graph.facebook.com/v19.0/act_{ACCOUNT_ID}/insights?level=campaign&fields=account_name,account_id,campaign_name,impressions,spend,actions&time_range={"since":"2024-04-07","until":"2024-04-07"}&access_token=${ACCESS_TOKEN}&filtering=[{field: "action_type",operator:"IN", value: ['link_click']}]&breakdowns=link_url_asset&use_account_attribution_setting=true 

I am not able to figure out from the Facebook documentation that what am I missing here.

Trying to log in with Facebook using the below code. code

I get the following error: URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs. Error

In the advanced tab, Valid OAuth redirect URIs is set to: https://smarteresto.com/facebookpost/callback

More settings

App key and secret are correct. Facebook SDK for PHP (v5)

I have the following code executing when a user logs in to facebook:

FB.Event.subscribe('auth.authResponseChange', checkLoginState); 

Here is the code to analayse:

    function checkLoginState(response) {         if (response.authResponse) {             // User is signed-in Facebook.             const unsubscribe = onAuthStateChanged(auth, (firebaseUser) => {                 unsubscribe();                 // Check if we are already signed-in Firebase with the correct user.                 if (!isUserEqual(response.authResponse, firebaseUser)) {                     // Build Firebase credential with the Facebook auth token.                     const credential = FacebookAuthProvider.credential(                         response.authResponse.accessToken);                     // Sign in with the credential from the Facebook user.                     let x = signInWithCredential(auth, credential)                         .catch((error) => {                             // Handle Errors here.                             const errorCode = error.code;                             const errorMessage = error.message;                             // The email of the user's account used.                             const email = error.customData.email;                             // The AuthCredential type that was used.                             const credential = FacebookAuthProvider.credentialFromError(error);                             alert("Login failed. Please try again.");                         });                     x.then((userCredential) => {                         // Signed in                         const user = userCredential.user;                         // login(response.authResponse.accessToken, firebasetoken???);                     });                 } else {                     // User is already signed-in Firebase with the correct user.                     console.log(response);                     // login(response.authResponse.accessToken, firebasetoken???);                 }             });         } else {             // User is signed-out of Facebook.             signOut(auth);         }     } 

I'm unsure how to pass the FIREBASE login token to verify in the backend (with kreait):

        $auth = (new Factory)             ->withServiceAccount($_ENV["PATH"].$_ENV['config']['storage']['firebase']['firebase']['file'] ?? 'firebase-service-account.json')             ->createAuth();         // verify token         $verifiedIdToken = $auth->verifyIdToken($token);         $uid = $verifiedIdToken->getClaim('sub'); // throws an InvalidToken when invalid 

Kreait docs: https://github.com/kreait/firebase-php

Any help is appreciated.

I'm developing an app that will make use of the Business On Behalf Of API (https://developers.facebook.com/docs/marketing-api/business-manager/guides/on-behalf-of#bm-client). Based on the steps in the documentation above, I was able to progress with regards to login (step 0), creation of the partnership between the BMs (step 1), generation of the access token for the client's BM system user (step 2) and I am stuck in obtaining the system user identification number (step 3) through the following request:

curl -i -X GET
"https://graph.facebook.com/v19.0/me?access_token=<CLIENT_BM_SU_ACCESS_TOKEN>"

I have a valid system user token, with all desired permissions and attributes, validated through the Access Token Debugger (https://developers.facebook.com/tools/debug/accesstoken/?access_token=...&version=v19. 0). However, the request to get this user's id continues to return an empty json as a response.

Request made: curl --location 'https://graph.facebook.com/v19.0/me?fields=id&access_token=...'.

The response is always {} (empty json).

access token debugger output

My app's permissions at login are: pages_read_engagement business_management ads_management

The system user access token created in the customer's BM has the following permissions: ads_management pages_read_engagement

as the documentation suggests (I've already tested generating this token with other permissions, but the problem persists).

I tried to research whether it was a lack of permissions, but I couldn't find anything conclusive. I researched the app's settings and didn't get promising results either. I tested using both Login and Login for Business as a Product for my app, but there was no difference in relation to the problem. Making this same request with user or system user tokens, administrators or not, from my accounts and my BM works as expected (returns the user id), but when it is a system user of the client's BM, following the step the step of the Business Intermediation documentation, it doesn't work.

I need this id to assign the assets to this user and then have access to the client's pages. By manually obtaining the user ID through the debugger and following the other steps, it is possible to complete the entire process and carry out the intermediation as expected (manage the assets on behalf of another company). However, this step is not allowing me to automate the process 100% and will hinder the usability of my application. Am I missing something?