2012-08-24 57 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

相關問題