我正在关注这个文档来创建在页面中工作的我的 facebook 应用程序,但我有一些错误。我创建了一个 index.php :
$i = parse_signed_request($_POST['signed_request'], $mysecret);
if ($i['oauth_token']){
echo "<script type='text/javascript'>
var oauth_url = 'http://www.facebook.com/dialog/oauth/';
oauth_url += '?client_id=MYAPPID';
oauth_url += '&redirect_uri=' + encodeURIComponent('http://www.facebook.com/pages/null/PAGE_ID/app_MYAPPID');
oauth_url += '&scope=email';
window.top.location = oauth_url;
</script>";
}else{
location.href="mypage.html";
}
我的应用程序的设置是:
Website with Facebook Login: http://mysite.com/app/
Canvas URL : http://mysite.com/app/index.php?canvas=1
Page TAB URL: http://mysite.com/app/index.php
此代码生成
API 错误代码:191 API 错误描述:指定的 URL 不属于应用程序错误消息:'无效的 redirect_uri 给定的 URL 不受应用程序配置的允许。'
我也尝试使用'http://www.facebook.com/MYPAGEALIAS/app_MYAPPID'作为redirect_uri,但得到同样的错误。
如果我将redirect_uri 更改为http://apps.facebook.com/MYAPPID/index.php(但这不是我想要的!)facebook 问我身份验证,并且在firefox 上一切正常(IE 进入无限循环)。
我在任何地方读过书,也做过其他测试,但我总是出错......