-1
我正在嘗試使用PHP(Codeigniter)執行腳本後向我的Facebook頁面發佈url/status。目前,我收到以下錯誤uncaught oauthexception invalid oauth access token signature.
我知道問題是與事實我的訪問令牌是錯誤的,但無論我在Facebook上閱讀多少文檔,我似乎無法弄清楚。有人可以給我一個解決方案,我將如何獲得訪問令牌?無法獲取Facebook訪問令牌?
include('system/libraries/facebook.php');
if($this->session->userdata('level') == "admin"){
$role = $this->input->post('role');
$company = $this->input->post('company');
$location = str_replace('+', ' ', $this->input->post('location'));
$category = str_replace('+', ' ', $this->input->post('category'));
$type = str_replace('+', ' ', $this->input->post('type'));
$description = $this->input->post('description');
$extract = $this->input->post('extract');
$date = time();
$link = $this->input->post('link');
if($this->input->post('closing_date')){
$closing_date = $this->input->post('closing_date');
$closing_date = str_replace('/', '-', $closing_date);
$closing_date = strtotime($closing_date);
}else{
$closing_date = time() + 2592000;
}
$url = str_replace(' ', '-', trim($role));
$location_dash = str_replace(' ', '-', trim($location));
$url = $url."-in-".$location_dash;
$this->db->set('role', $role);
$this->db->set('company', $company);
$this->db->set('type', $type);
$this->db->set('location', $location);
$this->db->set('category', $category);
$this->db->set('url', strtolower($url));
$this->db->set('description', $description);
$this->db->set('extract', $extract);
$this->db->set('link', $link);
$this->db->set('time', $date);
$this->db->set('closing_date', $closing_date);
$this->db->set('active', 1);
$this->db->insert('jobs');
$job = $this->db->get_where('jobs', array('time' => $date))->row_array();
$url = "http://www.example.com/job/view/".$job['id']."/".$job['url']."";
$facebook = new Facebook(array(
'appId' => '***',
'secret' => '***'
));
$message = array(
'access_token' => "***",
'message'=> "".$url.""
);
$facebook->api('/me/accounts','POST', $message);
_「我知道問題與我的訪問令牌是錯誤的事實有關_」,所以您認爲它很適合展示爲一些無趣的代碼,除了你自己獲取該訪問令牌...? – CBroe
@CBroe我目前從這裏獲取我的access_token https://developers.facebook.com/tools/explorer/?method=GET&path=me/accounts,但不確定我是否得到正確的訪問代碼 – learn
你必須得到令牌在Graph API Explorer中使用您自己的應用程序(從頂部的下拉列表中選擇),否則它將用於GAE應用程序,因此與您的app_id/app_secret不匹配。 – CBroe