2012-08-24 54 views
1

我想使用Facebook客户端认证而不使用JS SDK来避免弹出窗口。我尝试了许多方法,许多差异代码,但没有工作很多小时,请帮助。

这里我的代码Facebook认证redirect_uri不是绝对的URI

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,变更网址到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
appId + "&redirect_uri='" + 
encodeURIComponent('http://fb.spot-the-differences.com') + 
"'&scope=…"; 

这会在最终到达网址内为您提供类似&redirect_uri='http…的内容。

'当然是废话 - 删除它!

+0

非常感谢。这是我忽略的 – hsgu

相关问题