无法通过API获得instagram新添加的商家帐户

时间:2018-10-12 06:28:41

标签: facebook facebook-graph-api instagram instagram-api instagram-graph-api

我面临从API检索Instagram商业帐户的问题。

客户已获得我的应用程序的授权,一段时间后,他们将那里的Instagram个人帐户转换为企业帐户。

当我尝试获取新添加的Instagram企业帐户时,它们未显示在API响应中。

每次我都必须从帐户中删除应用程序并重新授权。我重新认证的应用仍然无法获得新添加的企业帐户。

对此有何解决方案?

以下是屏幕截图,了解更多信息http://nimb.ws/zfwl7e

 function fb_reauthenticate_relink()
 {

    $helper = $this->fb->getRedirectLoginHelper();
    $permissions = ['email', 'public_profile', 'manage_pages', 'read_insights', 'publish_pages', 'instagram_basic', 'instagram_manage_comments', 'instagram_manage_insights'];
    $loginUrl = $helper->getReAuthenticationUrl('facebook_reauthenticate_callback', $permissions);
    redirect($loginUrl);
 }

function facebook_reauthenticate_callback()
{
    $helper = $this->fb->getRedirectLoginHelper();

    try
    {
        $accessToken = $helper->getAccessToken();
    } catch (Facebook\Exceptions\FacebookResponseException $e)
    {
        // When Graph returns an error
        echo 'Graph returned an error: ' . $e->getMessage();
        exit;
    } catch (Facebook\Exceptions\FacebookSDKException $e)
    {
        // When validation fails or other local issues
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        exit;
    }


    $raw_accessToken = (string) $accessToken;

    $oAuth2Client = $this->fb->getOAuth2Client();

    $longLivedAccessToken = (string) $oAuth2Client->getLongLivedAccessToken($raw_accessToken);


    $url = "https://graph.facebook.com/v3.1/me/accounts?fields=instagram_business_account,connected_instagram_account,global_brand_page_name,access_token&access_token=" . $longLivedAccessToken;
    $request_response = $this->curl_request($url);

    // In $request_response didn't get newly added business profile

}

0 个答案:

没有答案