【发布时间】:2012-06-10 08:43:06
【问题描述】:
我正在关注this docs 来创建在页面中工作的我的 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 不属于应用程序 错误消息:“应用程序配置不允许给定 URL 无效的 redirect_uri。”
我也尝试使用“http://www.facebook.com/MYPAGEALIAS/app_MYAPPID”作为 redirect_uri,但得到了同样的错误。
如果我将我的 redirect_uri 更改为 http://apps.facebook.com/MYAPPID/index.php(但这不是我想要的!)facebook 问我身份验证,并且在 firefox 上一切正常(IE 进入无限循环)。
我在任何地方都读过书,也做过其他测试,但我总是出错...
【问题讨论】:
标签: api facebook-apps facebook-page facebook-oauth