weixin_33720186 2017-06-07 09:53 采纳率: 0%
浏览 20

护照-Facebook Ajax错误

I am trying with passport-facebook ajax

client

$('#fb').click(function(){
         $.ajax({
           url:'/auth/facebook',
           type: 'post',
           success:function(data){
             if(data.result == true){
              ...
             }else{
               ...
             }
           },
           error:function(request,status,error){
                console.log("code:"+request.status+"
"+"message:"+request.responseText+"
"+"error:"+error);
           }
           })
    });

error message

XMLHttpRequest cannot load https://www.facebook.com/dialog/oauth?~~~

 ...

Response for preflight is invalid (redirect)

i don't know this error..

help me please

  • 写回答

1条回答 默认 最新

  • weixin_33725807 2017-07-12 14:35
    关注

    Facebook does not allow scripts to load the login dialog, i guess to prevent phishing. You need to do the GET request via the browser URL by an anchor tag. Or you can get around it in your AJAX by doing:

    window.location.replace('http://yourdomain/auth/facebook')
    
    评论

报告相同问题?

悬赏问题

  • ¥15 nslt的可用模型,或者其他可以进行推理的现有模型
  • ¥15 arduino上连sim900a实现连接mqtt服务器
  • ¥15 vncviewer7.0安装后如何正确注册License许可证,激活使用
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并2
  • ¥66 关于人体营养与饮食规划的线性规划模型
  • ¥15 基于深度学习的快递面单识别系统
  • ¥15 Multisim仿真设计地铁到站提醒电路
  • ¥15 怎么用一个500W电源给5台60W的电脑供电
  • ¥15 请推荐一个轻量级规则引擎,配合流程引擎使用,规则引擎负责判断出符合规则的流程引擎模板id
  • ¥15 Excel表只有年月怎么计算年龄