Facebook OAuthException: Error validating application -
i have simple php page going used post message own wall.
i've obtained offline_access token has "read_stream" , "publish_stream" permissions.
define('fb_apikey', 'my_app_key'); define('fb_secret', 'my_app_secret'); define('fb_session', 'my_offline_token'); require_once('facebook.php'); try { $facebook = new facebook(fb_apikey, fb_secret); $facebook->api_client->session_key = fb_session; $attachment = array( 'message' => 'some meesgae', 'name' => 'this demo facebook application!', 'caption' => "caption of post", 'link' => 'mylink.com', 'description' => 'this description', 'actions' => array(array( 'name' => 'get search', 'link' => 'google.com' )) ); $result = $facebook->api('/me/feed?access_token=' . fb_session, 'post', $attachment); var_dump($result); } catch(exception $e) { echo $e; }
when run this, "oauthexception: error validating application".
i confirmed offline token good. when go https://graph.facebook.com/me?access_token=[my_offline_token], returns public profile in json format correctly.
so, i'm thinking i'm doing wrong api call somewhere life of me can't seem figure out. i've been wrestling issue last 2 days. please help! :(
you don't have app id here. , make calls this:
require_once('facebook.php'); $facebook = new facebook( array( 'appid' => 'app_id', 'secret' => 'app_secret', 'cookie' => true )); try { $attachment = array( 'message' => 'some meesgae', 'name' => 'this demo facebook application!', 'caption' => "caption of post", 'link' => 'mylink.com', 'description' => 'this description', 'actions' => array(array( 'name' => 'get search', 'link' => 'google.com' )) ); $attachment['access_token'] = $offline_access_token; // add array $result = $facebook->api('/me/feed', 'post', $attachment ); var_dump($result); } catch(exception $e) { // error_log( $e ); // should use when in production echo $e; }
untested, should work. let me know if doesn't.
Comments
Post a Comment