facebook-javascript-sdk – 使用facebook登录网页应用时,redirect_uri设置在哪里?

我有一个angular-ui-router网络应用程序.

有代码:

window.fbAsyncInit = function () {
    console.log('loginCtrl.window.fbAsyncInit: initiating FB ...');
    FB.init({
        appId: '1058057514286456', // rand's peoplecount-www app
        //status: true,
        //cookie: true,
        xfbml: true,
        version: 'v2.5'
    });
(function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {
        return;
    }
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

当我点击login-with-facebook按钮时,它会调用:

FB.login(function (response) {
    console.log('FB Reg : Response - ' + JSON.stringify(response));
    if (response.authResponse) {
        console.log('Welcome!  Fetching your information.... ');
        FB.api('/me', {fields: 'name, email,first_name,last_name,verified'}, function (response) {
            $scope.saveUserInfo('$scope.fbRegistration', response);
            console.log('fbReg: api response='+JSON.stringify(response));
        });
    } else {
        console.log('fbReg: User cancelled login or did not fully authorize. response='+JSON.stringify(response));
    }
});

当我点击facebook登录按钮时,我会打开一个Facebook对话框,其中显示一条消息:

URL Blocked
This redirect failed because the redirect URI is not whitelisted
in the app’s Client OAuth Settings. Make sure Client and Web OAuth
Login are on and add all your app domains as Valid OAuth Redirect URIs.

它使用什么重定向URI?我在哪里设置它?

https://developers.facebook.com/docs/facebook-login/web ===此网页上没有任何内容涉及重定向URI

https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow ===这会调用一个带有redirect_uri的网址.我必须使用这种手动方法吗?

https://www.facebook.com/dialog/oauth?
    client_id={app-id}
    &redirect_uri={redirect-uri}

谢谢

最佳答案 所有重定向URI都应在App的仪表板中列入白名单.

仪表板可在
https://developers.facebook.com/访问

《facebook-javascript-sdk – 使用facebook登录网页应用时,redirect_uri设置在哪里?》

在产品类别下,您应该看到“Facebook登录”(如果不是 – 只需通过“添加产品”选项创建)
在“Facebook登录”上,您将找到“有效OAuth重定向URI”参数,您可以在其中将URI列入白名单.

《facebook-javascript-sdk – 使用facebook登录网页应用时,redirect_uri设置在哪里?》

Facebook安全人员解释了为什么在9点50分左右可能需要https://www.facebook.com/FacebookforDevelopers/videos/10152795636318553/.

从2018年3月开始,只有这样列入白名单的URI才能调用Facebook API.

点赞