I try to set up OpenHab Cloud with the Google Assistant functions.
I got everything ready and working, but I cannot link the Google Assistant with my OpenHab Cloud instance.
In Google Home app i got a error message:
The setting could not be updated. Check your connection.
Looking in the logs from OpenHab Cloud, I found the following:
2018-04-14T08:09:42.940Z - info: openHAB-cloud: server.authorization oauth2 request for scope: google-assistant
ForbiddenError: invalid csrf token
at csrf (/root/openhab-cloud/node_modules/csurf/index.js:112:19)
at /root/openhab-cloud/app.js:269:9
at Layer.handle [as handle_request] (/root/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
at /root/openhab-cloud/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
at Context.next (/root/openhab-cloud/node_modules/express/lib/router/index.js:275:10)
at Context.actions.pass (/root/openhab-cloud/node_modules/passport/lib/passport/context/http/actions.js:77:8)
at SessionStrategy.authenticate (/root/openhab-cloud/node_modules/passport/lib/passport/strategies/session.js:67:10)
at attempt (/root/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:243:16)
at Passport.authenticate (/root/openhab-cloud/node_modules/passport/lib/passport/middleware/authenticate.js:244:7)
at Layer.handle [as handle_request] (/root/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
at /root/openhab-cloud/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
at next (/root/openhab-cloud/node_modules/express/lib/router/index.js:275:10)
at Passport.initialize (/root/openhab-cloud/node_modules/passport/lib/passport/middleware/initialize.js:69:5)
at Layer.handle [as handle_request] (/root/openhab-cloud/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/root/openhab-cloud/node_modules/express/lib/router/index.js:317:13)
at /root/openhab-cloud/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/root/openhab-cloud/node_modules/express/lib/router/index.js:335:12)
at next (/root/openhab-cloud/node_modules/express/lib/router/index.js:275:10)
I am running OpenHabCloud behind a apache2 reverse proxy, if this matters. The configuration file looks like that:
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://192.168.1.119:3000/
ProxyPassReverse / http://192.168.1.119:3000/
I’m pretty sure you can only like to Google Assistant through the myopenhab.org instance of openHAB Cloud.
From the main posting:
This integration allows you to connect your openHAB through the myopenHAB.org cloud service to Google Assistant and control your openHAB by voice control.
But I think you can get it to work with your own cloud following the instructions here:
The error implies you have something wrong with the OAuth between Google and your cloud instance.
I have set up my OpenHab Cloud instance using the Readme you provide me. I know that there is something wrong between Google and my OpenHab Cloud instance, but I can’t imagine what.
My openHAB-cloud instance is working. I can control my openHAB instance with it. I’m at the point to connect Google Assistant with my openHAB-cloud instance using Google Home app. I get to the login page from my openHAB-cloud instance and need to confirm the permissions. After that I get the described error message.
If you dont run your setup with HTTPs and „official“ DNS than it wont work. OHC will work, but Google Assistant Platform, which calls your own deployed openHAB-Google-Assistant Function, cant access it.
This might be the cause of your problem…
I am using SSL with Let’s Encrypt certificate and also a “official” dns subdomain. Would it help if I send you the url of the OHC instance via private message? I don’t want to made it public here.
Hi Marcel, did you ever find the cause of the problem? I’ve just hit the exact same thing, like yourself I’m using a self signed let’s encrypt cert, although I used nginx like the openhab-cloud readme says.