I cant seem to get the facebook login for business javascript SDK to work when trying to get the System User access token. It works for the normal User access token.
5

Below is the javascript I used for the System user access token and the User access token.

window.fbAsyncInit = function() { //2. FB JavaScript SDK configuration and setup FB.init({ appId : '********', // FB App ID cookie : true, // enable cookies to allow the server to access the session xfbml : true, // parse social plugins on this page version : 'v17.0' // uses graph api version v17.0 }); };

//1. Load the JavaScript SDK asynchronously
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

 //3. Facebook login with JavaScript SDK
function launchFBE() {
    FB.login(function (response) {
        if (response.authResponse) {
            // returns a User Access Token with scopes requested
            const accessToken = response.authResponse.accessToken;
            const message = {
                'success':true,
                'access_token':accessToken,
            };

            // store access token for later  
        } else {
          console.log('User cancelled login or did not fully authorize.');
        }
    }, {
        config_id: '123456789456', // configuration ID goes here
        response_type: 'code'   // must be set to 'code' for SUAT
        // scope: 'ads_management',
      // refer to the extras object table for details
        // extras: {
        //     "setup":{
        //       "external_business_id":"12345678912",
        //       "timezone":"Africa\/Johannesburg",
        //       "currency":"ZAR",
        //       "business_vertical":"ADS_TARGETING"
        //     },
        //     "business_config":{
        //       "business":{
        //          "name":"**"
        //       },
        //       "ig_cta": {
        //         "enabled": true,
        //         "cta_button_text": "Find Out More",
        //         "cta_button_url": "https://www.***.com"
        //       }
        //     },
        //     "repeat":false
        // }
    }

    );

}
Justin
Asked about 11 months ago
Sandeep

Even I'm facing same issue. Did you found any work around?

August 18 at 9:12 AM
Karan

same here

August 18 at 9:13 AM
Sandeep

Please check https://developers.facebook.com/community/threads/673096141505187/?post_id=673096144838520

August 18 at 9:13 AM
Simón

I am having exactly the same issue. UAT works fine, but for SUAT I just don't get a response in the FB.Init method

September 30 at 11:09 AM