Own OpenHAB Cloud couldn´t register a user

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)

Does anybody have an idea ?
Regards
Kobelka

I’m seeing this same error. Did you find a solution???

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?

i go on foo.com and after i submit register in the addressline shows foo.com/register

Is one secure (https) and one not?

It is both https

No, I hope @ryandetzel will find some :slight_smile:

@vbbaby3
my installation on new server get this error too, old server installed with the same methode up dan running well.

any solution?

I managed to make the server run as expected after I get app.js file from my old server.

@Haoe can you upload your old app.js file somewhere or compare it with the new one ?

sure, Here

1 Like

@Haoe With this mine works too…

@digitaldan I saw on github that you made some changes, but my skills are too low…Can you have a look on this :innocent:

Glad to hear it works for you.
Have no time to compare both, making it work is my priority at this moment .:slight_smile:

Worked for me too!!! Thanks!

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.

It now works for me with the new version too.
It seems to be that you need to have redis-server version >=2.6 (I found this somewhere in the www :sunglasses:)

$ sudo add-apt-repository ppa:chris-lea/redis-server

$ sudo apt-get update

$ sudo apt-get install redis-server

@ryandetzel I think you could add this to your tutorial :wink:

1 Like

Did it for me, back to the newest “app.js”.

Thanks!

I tried also to install the new redis-server, but I get the same error message…

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.

Help!

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.