javascript - Facebook 身份验证 redirect_uri 不是绝对 URI

标签 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/

最佳答案

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

这将使您在最终 URL 中得到类似 &redirect_uri='http… 的内容。

' 当然是无稽之谈 - 删除它!

关于javascript - Facebook 身份验证 redirect_uri 不是绝对 URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12108638/

相关文章:

ios - Facebook 应用程序类型 : Which one to pick for mobile AND web?

iphone - Facebook:我怎样才能随时将照片贴到墙上

Android Facebook SDK - android.support-v4 问题(找不到类 android.support.v4.app.Fragment)

javascript - 开发过程中如何在javascript中使用假对象并避免CORS错误

javascript - 延迟加载 javascript

Android facebook sdk登录报错1118578

javascript - Passport Facebook策略,使用AJAX触发路由

iOS Facebook 身份验证 URL 方案

javascript - 在多个数据绑定(bind)中使用模板

javascript - 用于 jquery 和点击事件的 DataTables 插件