Facebook登录API HTTPS问题 [英] Facebook Login API HTTPS Issue

查看:228
本文介绍了Facebook登录API HTTPS问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在工作的网站具有Facebook登录选项,但最近有用户报告说该网站不适用于他们.我禁用了扩展程序等,我的控制台出现了此错误:

The website I'm working on has a Facebook login option, but recently a user reported it wasn't working for them. I disabled my extensions etc, I got this error in my console:

Blocked a frame with origin "https://www.facebook.com" from accessing a frame 
with origin "http://static.ak.facebook.com".  The frame requesting access has 
a protocol of "https", the frame being accessed has a protocol of "http". 
Protocols must match.

是否可以提供给API的选项可以使它在相同的协议上工作?仅供参考,主要网站运行在HTTP(无S)上.

Is there an option I can feed to the API that will get it to work on the same protocols? FYI, the primary website runs on HTTP (no S).

这很奇怪,因为它似乎突然停止工作(但是有可能这总是一个问题,因为我是新来的并且正在学习此系统).

It is especially odd because it seems like it stopped working all of a sudden (but it is possible this was always a problem as I am new and am learning this system).

我在页面底部有以下代码:

I have this code at the foot of my page:

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId  : ..., // App ID
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true,  // parse XFBML
            channel: '//...mychannel.../channel'
        });

        FB.Event.subscribe('auth.authResponseChange', function(fbResponse) {
            // function that logs in user
        });
    };

    // Load the SDK Asynchronously
    (function(d){
        var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        ref.parentNode.insertBefore(js, ref);
    }(document));
</script>

推荐答案

对于它的价值,我设法通过转换为HTTPS来解决此问题(无论如何我应该一直这样做).

For what it's worth, I managed to fix this issue by converting to HTTPS (which is what I should have been doing anyway).

这篇关于Facebook登录API HTTPS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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