1

I have an old piece of php code calling Facebook, that used to work fine until a week ago. Now it suddenly stopped working. Here are the relevant lines involved:

<?php
require_once __DIR__ . '/facebook-sdk-v562/autoload.php';

// -- skipping here less relevant lines --

// Initialize Facebook Environment:
$default_graph_version = 'v2.10';
$fb = new Facebook\Facebook([
  'app_id' => $app_id,
  'app_secret' => $app_secret,
  'default_graph_version' => $default_graph_version
]);

// Redirect to phase2 for facebook login:
$helper = $fb->getRedirectLoginHelper();
$fbPermissions = ['manage_pages', 'publish_pages'];
$loginUrl = $helper->getLoginUrl($phase2_url, $fbPermissions);
header('Location: ' . $loginUrl);

Now upon reaching the header line, I get: "Sorry, something went wrong. We're working on getting this fixed as soon as we can." -- I have a feeling (not sure) it has to do with using old versions of things? Has something changed in the recent days (May 2022)?

EDIT:
I've made certain updates in order to match new Graph API version. I used compose to download the new php sdk, I modified the require_once accordingly, and I modified v2.10 to v13.0. I still get the exact same error.
I checked the value of $loginUrl that gives me the error after redirection, and it is (shortened): https://www.facebook.com/v13.0/dialog/oauth?client_id=[***]&state=[***]&response_type=code&sdk=php-sdk-5.7.0&redirect_uri=[my correct url]&scope=manage_pages%2Cpublish_pages

2

1 Answer 1

1

I don't know why, but omitting the "permissions" argument to getLoginUrl altogether -- solved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.