我正在使用服务器端脚本进行 facebook 授权,它在 Chrome 和 Mozilla 中完美运行,但在 Opera 和 IE 中出现错误。
我的步骤如下: 1. 我在弹出窗口中打开 www.facebook.com/dialog/oauth?&client_id={client_id}&redirect_uri={redirect_uri?} - 很好,然后我得到了“代码”并在我的页面上使用它
if (isset($_GET['code'])) { $curl = curl_init(' https://graph.facebook.com/oauth/access_token?client_id= {client_id}&redirect_uri={redirect_uri}&code='.$_GET ['代码']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE); $s = curl_exec($curl); curl_close($curl); $access_token = explode('=', $s); $tempacc = explode('&', $access_token[1]); $access_token = $tempacc[0];
if($access_token[1] != ''){ $curl = curl_init('https://graph.facebook.com/debug_token?&input_token='.$access_token.'&access_token='.$access_token); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, TRUE); $s = curl_exec($curl); curl_close($curl); $user = json_decode($s, true); print_r($user); //get error - Array ( [error] => Array ( [message] => (#100) You must provide an app access token or a user access token that is an owner or developer of the app [type] => OAuthException [code] => 100 ) )
}
在 Chrome 和 Mozilla 中同样完美
我还在这里的 explorer 中检查了请求的 access_token developers.facebook.com/tools/debug/access_token?q={my_token} 并且它有效
有任何想法吗?