我想在没有 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/