Facebook身份验证redirect_uri不是绝对URI

时间:2012-08-24 11:34:01

标签: javascript facebook facebook-authentication

我想在没有JS SDK的情况下使用facebook客户端身份验证来避免弹出窗口。我尝试了许多差异代码的许多方法,但是没有什么工作可以帮助很多时间。

这是我的代码

FB.init({
    appId  : appId,
    status : true,  // check login status
    cookie : true,  // enable cookies to allow the server to access the session
    xfbml  : false, // parse XFBML
    channel : 'http://fb.spot-the-differences.com/index.php',
    oauth : true
});
FB.getLoginStatus(function(response) {
    if (response.status == 'connected') {
        ...
    } else if (response.status === 'not_authorized') {            
    top.location = "https://www.facebook.com/dialog/oauth?client_id=" + 
    appId + "&redirect_uri='" +
    encodeURIComponent('http://fb.spot-the-differences.com') +
    "'&scope=read_friendlists,publish_actions,publish_stream,email&esponse_type=token";
});

我尝试添加/index.php,将url更改为ip地址尝试多个代码,但总是错误

API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri isn't an absolute URI. Check RFC 3986.

Facebook基本设置

Site URL: http://fb.spot-the-differences.com/
Canvas Page: http://apps.facebook.com/spot-the-differences
Canvas URL: http://fb.spot-the-differences.com/
Secure Canvas URL: https://fb.spot-the-differences.com/

1 个答案:

答案 0 :(得分:2)

appId + "&redirect_uri='" +
encodeURIComponent('http://fb.spot-the-differences.com') +
"'&scope=…";

这样可以在最终网址中找到类似&redirect_uri='http…的内容。

'当然是废话 - 删除它!

相关问题