Hi,
I installed my own OpenHab Cloud on a Scaleway Cloud Server. I used this great Tutorial from @ryandetzel.
I can see the login page, but when I try to register a user I get the following error:
ForbiddenError: invalid csrf token
at verifytoken (/var/www/cloud.de/openhab-cloud/node_modules/csurf/index.js:263:11)
at csrf (/var/www/cloud.de/openhab-cloud/node_modules/csurf/index.js:93:7)
at Object.handle (/var/www/cloud.de/openhab-cloud/app.js:268:13)
at Context.next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Context.actions.pass (/var/www/cloud.de/openhab-cloud/node_modules/passport/lib/passport/context/http/actions.js:77:8)
at SessionStrategy.authenticate (/var/www/cloud.de/openhab-cloud/node_modules/passport/lib/passport/strategies/session.js:67:10)
at attempt (/var/www/cloud.de/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:243:16)
at Passport.authenticate (/var/www/cloud.de/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:244:7)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Passport.initialize (/var/www/cloud.de/openhab-cloud/node_modules/passport/lib/passport/middleware/initialize.js:69:5)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Object.handle (/var/www/cloud.de/openhab-cloud/node_modules/connect-flash/lib/flash.js:21:5)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Object.session [as handle] (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/express-session/index.js:386:7)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Object.cookieParser [as handle] (/var/www/cloud.de/openhab-cloud/node_modules/cookie-parser/index.js:48:5)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at methodOverride (/var/www/cloud.de/openhab-cloud/node_modules/method-override/index.js:79:5)
at /var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:41:7
at methodOverride (/var/www/cloud.de/openhab-cloud/node_modules/method-override/index.js:79:5)
at Object.handle (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:39:5)
at next (/var/www/cloud.de/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
is the form posting to the same domain? So, you’re on domain foo.com and when you hit submit it tries to go to foo.com/register right? No myopenhab.org?
Interesting, it’s possible that something changed from the time I did the tutorial and you guys did thus the difference but I’m assuming it’s something else. Glad to hear you got it working though.
I run into the same problem since this morning.
Everything worked fine untill i tried to logon this morning (did not change a thing)
When trying to log on to my own openhab cloud i get the following error:
ForbiddenError: invalid csrf token
at verifytoken (/var/www/openhab.heerle.com/openhab-cloud/node_modules/csurf/index.js:263:11)
at csrf (/var/www/openhab.heerle.com/openhab-cloud/node_modules/csurf/index.js:93:7)
at Object.handle (/var/www/openhab.heerle.com/openhab-cloud/app.js:268:13)
at Context.next (/var/www/openhab.heerle.com/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Context.actions.pass (/var/www/openhab.heerle.com/openhab-cloud/node_modules/passport/lib/passport/context/http/actions.js:77:8)
at SessionStrategy.authenticate (/var/www/openhab.heerle.com/openhab-cloud/node_modules/passport/lib/passport/strategies/session.js:67:10)
at attempt (/var/www/openhab.heerle.com/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:243:16)
at Passport.authenticate (/var/www/openhab.heerle.com/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:244:7)
at next (/var/www/openhab.heerle.com/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Passport.initialize (/var/www/openhab.heerle.com/openhab-cloud/node_modules/passport/lib/passport/middleware/initialize.js:69:5)
at next (/var/www/openhab.heerle.com/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at Object.handle (/var/www/openhab.heerle.com/openhab-cloud/node_modules/connect-flash/lib/flash.js:21:5)
at next (/var/www/openhab.heerle.com/openhab-cloud/node_modules/express/node_modules/connect/lib/proto.js:174:15)
at /var/www/openhab.heerle.com/openhab-cloud/node_modules/express/node_modules/express-session/index.js:421:7
at Command.callback (/var/www/openhab.heerle.com/openhab-cloud/node_modules/connect-redis/lib/connect-redis.js:148:25)
at normal_reply (/var/www/openhab.heerle.com/openhab-cloud/node_modules/redis/index.js:714:21)
at RedisClient.return_reply (/var/www/openhab.heerle.com/openhab-cloud/node_modules/redis/index.js:816:9)
at JavascriptRedisParser.returnReply (/var/www/openhab.heerle.com/openhab-cloud/node_modules/redis/index.js:188:18)
at JavascriptRedisParser.execute (/var/www/openhab.heerle.com/openhab-cloud/node_modules/redis-parser/lib/parser.js:560:12)
at Socket. (/var/www/openhab.heerle.com/openhab-cloud/node_modules/redis/index.js:267:27)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
I’ve tried rebooting, updating redis but have not found a working solution yet.
p.s. the habdroid clients seem to work just fine using the same openhabcloud.
This will be a shot in the dark at best, but, I have had this happen twice, each time I renamed the current app.js to app.js.new and used the one provided by Haoe, in the link above, this allowed me to logon. I then shut the server down and renamed the app.js to app.js.old, and renamed app.js.new to app.js, and restarted the server and everything was working ok again.
Don’t ask how I found this, I’ve baffled programmers for years when I break their programs and then give them a four page procedure on how to produce the fault! LOL!!! Actually it dawned on me what was happening the 2nd time I had to fix, the 3rd time was the charm, although I am still not 100% sure what happened, I did some OS updated, and was also changing the IP addresses, and moving from clear to SSL, I think it was the network changes that caused this to happen.
If you should try this and it works, please let ryandetzel know as it will be PROOF of my concept.