I'm integrating Facebook Business Login using the Facebook JS SDK. Despite following many tutorials and the official guide, I've encountered a persistent issue over the past few days. I believe this might be an edge case specific to my setup.

The problem

Both FB.getLoginStatus() and FB.login() call functions return below response.

{authResponse: null, status: 'unknown'}  

I'm certain I've logged into Facebook and it should show "connected" instead. The issue is that callback functions are being triggered before Facebook returns the response. For example, when FB.login() opens the login dialog, the console shows the callback response before login completion. Additionally, after completing the login, the callback function is no longer called. Here is a screenshot:

Here is the source code

(I just copy-pasted from Facebook Offical Guide)

    <!DOCTYPE html> <html> <head> <title>Facebook Login JavaScript Example</title> <meta charset="UTF-8"> </head> <body> <script>   function statusChangeCallback(response) {  // Called with the results from FB.getLoginStatus().     console.log('statusChangeCallback');     console.log(response);                   // The current login status of the person.     if (response.status === 'connected') {   // Logged into your webpage and Facebook.       testAPI();       } else {                                 // Not logged into your webpage or we are unable to tell.       console.log( 'Please log ' +         'into this webpage.');         FB.login((response) => {           console.log(response)         },{             "config_id":{{FACEBOOK_CONFIG_ID}}         })     }   }   function checkLoginState() {               // Called when a person is finished with the Login Button.     FB.getLoginStatus(function(response) {   // See the onlogin handler       statusChangeCallback(response);     });   }   window.fbAsyncInit = function() {     FB.init({       appId      : '{{FACEBOOK_APP_ID}}',       cookie     : true,                     // Enable cookies to allow the server to access the session.       xfbml      : true,                     // Parse social plugins on this webpage.       version    : 'v20.0'           // Use this Graph API version for this call.     });     FB.getLoginStatus(function(response) {   // Called after the JS SDK has been initialized.       statusChangeCallback(response);        // Returns the login status.     });   };     function testAPI() {                      // Testing Graph API after login.  See statusChangeCallback() for when this call is made.     console.log('Welcome!  Fetching your information.... ');     FB.api('/me', function(response) {       console.log('Successful login for: ' + response.name);       document.getElementById('status').innerHTML =         'Thanks for logging in, ' + response.name + '!';     });   } </script> <!-- The JS SDK Login Button --> <fb:login-button config_id="{{FACEBOOK_CONFIG_ID}}" onlogin="checkLoginState();"> </fb:login-button> <div id="status"> </div> <!-- Load the JS SDK asynchronously --> <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script> </body> </html> 

My Environment

I use Facebook Business Login so I can ask my clients permission to manage their pages. I've configured User Access Token configuration and included my Config ID in both login button and in FB.login() function. My Business is verified. I'm testing this in localhost. (I have local ssl and I use HTTPS. Also I've deployed this in my live web app where i have https as well and facing the same problem). My App is in Live mode.

Below are some screenshots from my app configs. I'm trying to give lot of details as I beleive this might be specific to my app configurations.

What I've Tried

  1. I've tried both FB.login() and Facebook login Button. (with facebook login button the onlogin callback function never getting called)

  2. I've deleted ALL my cookies and files

  3. I've deployed this in Live web app

UPDATE

There is a fblo_<app_id> cookie, which my research indicates is a Facebook logout cookie, defaulting to a value of "y". When I manually delete this cookie, the status changes to "connected" (sometimes this works and sometimes not.). However, it's not feasible to ask my clients to perform this action on their end. Additionally, the callback functions are still being triggered before the login (reconnect) process is complete. So maybe there might be an issue related to cookies or sessions.

I'm trying to make a bot that replies to facebook comments on my page's livestream. Unfortunately, after a few replies, Facebook send back an error message with code 368 and I can only send more replies after a few seconds. The full message is:

We limit how often you can post, comment or do other things in a given amount of time in order to help protect the community from spam. You can try again later 

The API I'm using is /${page_id}/comments
There seem to be a lot of people got into my issue as well: https://developers.facebook.com/support/bugs/938590201317189

Page access token expires periodically and if it expires, I need to generate a new one manually.

Is it possible if the page access token can be refresh via code?

Here's my code in react typescript:

const PAGE_ACCESS_TOKEN = "EAAcAHP"; const PAGE_ID = "123456"; export const fetchPageFeed = async () => {   try {     // Fetch page profile picture     const pageInfoResponse = await axios.get(       `https://graph.facebook.com/${PAGE_ID}`,       {         params: {           access_token: PAGE_ACCESS_TOKEN,           fields: "picture{url},name,link",          },       }     );     // Fetch page posts     const postsResponse = await axios.get(       `https://graph.facebook.com/${PAGE_ID}/posts`,       {         params: {           access_token: PAGE_ACCESS_TOKEN,           fields:             "id,message,created_time,picture,full_picture,attachments{media_type,media},reactions.summary(total_count),comments.summary(total_count),shares,video_tags,videos{source,description,thumbnails}",         },       }     );     return {       profilePictureUrl: pageInfoResponse.data.picture.data.url,       pageName: pageInfoResponse.data.name,       pageUrl: pageInfoResponse.data.link,        posts: postsResponse.data.data,     };   } catch (error) {     console.error("Error fetching page feed:", error);     return { profilePictureUrl: "", pageName: "", pageUrl: "", posts: [] };    } }; 

Trying to do Data Use Checkup. Went through the whole process and when submitting it gives an error: "An error occurred while submitting Data Use Checkup. Please try again later". I tried later several times but same thing is happening. What kind of bug is this. how to fix it or ask to fix it from FB
thanks

Yesterday all templates suddenly stopped working, even with different numbers associated with the app. Meta returns the following response:
{ "error": { "message": "(#135000) Generic user error", "type": "OAuthException", "code": 135000, "error_data": { "messaging_product": "whatsapp", "details": "Generic user error" }, "fbtrace_id": "AvBt1NvrjsxKhrhe3GS8V1b" } }
What should I do or who can I contact to solve this issue?