Facebook身份验证redirect_uri不是绝对的URI [英] Facebook authentication redirect_uri isn't an absolute URI

查看:700
本文介绍了Facebook身份验证redirect_uri不是绝对的URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这里我的代码


I would like to use facebook Client-side authentication without the JS SDK to avoid popup. I try many ways many differences code but nothing work for many hours please help.

here my code

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地址尝试许多代码,但总是错误

I try add /index.php , change url to ip address try many codes but it always error

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=…";

这会让你像& redirect_uri ='http ...

This will get you something like &redirect_uri='http… inside of the final URL.

'当然是废话 - 删除它!

The ' is of course nonsense there – remove it!

这篇关于Facebook身份验证redirect_uri不是绝对的URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆