Facebook authentication redirect_uri isn't an absolute URI

落爺英雄遲暮 提交于 2019-12-23 02:26:10

问题


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";
});

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 basic setting

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

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

The ' is of course nonsense there – remove it!



来源:https://stackoverflow.com/questions/12108638/facebook-authentication-redirect-uri-isnt-an-absolute-uri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!