如何通过使用Openhab UI的openhab API通过我的UI注册用户

时间:2018-07-26 12:45:11

标签: openhab

我使用了以下代码:

var input_element = document.getElementById("Element");
input_element.addEventListener("drop", function (event) {
    var types = event.dataTransfer.types;

    if (types.length > 2 || types.indexOf("text/plain") === -1)
        event.preventDefault();
    else{
      setTimeout(function(){ input_element.value = ""; },10);
    }
}, false);

但是我收到此错误:ForbiddenError:无效的csrf令牌,任何人都可以帮我解决这个问题

{“ readyState”:4,“ responseText”:“ \ n \ n \ n \ n错误\ n \ n \ n

ForbiddenError: invalid csrf token
   

at csrf (/home/ubuntu/openhab-cloud/node_modules/csurf/index.js:112:19)
   

at /home/ubuntu/openhab-cloud/app.js:277:9
   

at Layer.handle [as handle_request] (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
   

at trim_prefix (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
   

at /home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:284:7
   

at Function.process_params (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
   

at Context.next (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:275:10)
   

at Context.actions.pass (/home/ubuntu/openhab-cloud/node_modules/passport/lib/passport/context/http/actions.js:77:8)
   

at SessionStrategy.authenticate (/home/ubuntu/openhab-cloud/node_modules/passport/lib/passport/strategies/session.js:67:10)
   

at attempt (/home/ubuntu/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:243:16)
   

at Passport.authenticate (/home/ubuntu/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:244:7)
   

at Layer.handle [as handle_request] (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
   

at trim_prefix (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
   

at /home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:284:7
   

at Function.process_params (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
   

at next (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:275:10)
   

at Passport.initialize (/home/ubuntu/openhab-cloud/node_modules/passport/lib/passport/middleware/initialize.js:69:5)
   

at Layer.handle [as handle_request] (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
   

at trim_prefix (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
   

at /home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:284:7
   

at Function.process_params (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
   

at next (/home/ubuntu/openhab-cloud/node_modules/express/lib/router/index.js:275:10)

0 个答案:

没有答案