Unknown error when trying to get long lived access token

Posted by Marius.Radvan on Stack Overflow See other posts from Stack Overflow or by Marius.Radvan
Published on 2012-06-22T09:11:17Z Indexed on 2012/06/22 9:16 UTC
Read the original article Hit count: 196

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

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook-page