Unknown error when trying to get long lived access token
- by Marius.Radvan
I am trying to get a long lived access token for one of my pages, using this code:
$page_info = $facebook->api("/page-id?fields=access_token");
$access_token = array(
"client_id" => $facebook->getAppId(),
"client_secret" => $facebook->getAppSecret(),
"grant_type" => "fb_exchange_token",
"fb_exchange_token" => $page_info["access_token"]
);
$result = $facebook->api("/oauth/access_token", $access_token);
echo json_encode($result);
... but I get this response: {"error_code":1,"error_msg":"An unknown error occurred"}
I get the same response if I browse to
https://graph.facebook.com/oauth/access_token?
client_id=APP_ID&
client_secret=APP_SECRET&
grant_type=fb_exchange_token&
fb_exchange_token=EXISTING_ACCESS_TOKEN
as stated in https://developers.facebook.com/roadmap/offline-access-removal/#page_access_token