Openhab and Google Assistant - Oauth2 Config

oauth
googlehome
Tags: #<Tag:0x00007f014863b5c8> #<Tag:0x00007f014863b398>

(Chris Walker) #1

Hi,

I’m attempting to configure my Google Homes to control my OpenHAB items. I have been following the instructions at https://github.com/openhab/openhab-google-assistant , but have got stuck right near the end.

For the “Account Linkage & OAuth2” section, I need four pieces of information.
The authorisation and token URLs. Are these the URLs to my OpenHAB cloud instance?

Does anyone know where can I obtain the Client ID and Client Secret from?

Currently when I attempt to use the Web Functions app that I have created, I get a “Cannot GET /oauth” message. In this consistent with OAuth not being configured correctly?


(Michael Aschenborn) #2

Hi,
since yesterday it finally works for me - after a lot of trial and error.
I used the credentials from https://console.cloud.google.com/apis/credentials


The credentials and the scope I had to enter in the MongoDB of my myopenhab-installation.

Michael


(Chris Walker) #4

Thanks Michael. I’m now much further along.
When “testing” my app, I get a login prompt from my OpenHAB Cloud instance, but, after logging in, I don’t get an option to authorize the app though. I get the following error.


Do you have any idea why I’m getting this?

“The credentials and the scope I had to enter in the MongoDB of my myopenhab-installation.” Did you do this during the authorizing stage in Openhab?


(Chris Walker) #5

I switched from my Openhab cloud instance to myopenhab.org and now I get a message saying “forbidden” when I login.


(Mustapha MAKBOUL) #6

HI Michael,

Could you please tell me how to enter the credentials and scope in the MongoDB of myopenhab installation ?

Thanks and Regards,


(Michael Aschenborn) #7

I used these 2 commands:
db.oauth2scopes.insert( { name : “google-assistant”, description: “Access to myopenHAB specific API for Actions on Google Assistant”, } )
db.oauth2clients.insert({ clientId: “xxxxx”, clientSecret: “xxxxxxxxx” })


(Panagiotis Adamopoulos) #8

Hi guys,

I am attempting also to configure my google home to control my openHAB items. I 've also followed the instructions from https://github.com/openhab/openhab-google-assistant with success but i got stuck on the same point.

Does anyone know how i can get the authorization code and the token from myopenhab?

I am getting bad request.

I’ve got wrong configuration?

client%20info

Thanks in advance,
Takis


(Rich Koshak) #9

You should be following the instructions here. the instructions in the README on github are for when you are hosting your own instance of myopenhab.org.


(Panagiotis Adamopoulos) #10

Thanks a lot @rlkoshak. I think i took the hard way :stuck_out_tongue:
I follow the instructions and as myopenhab works properly the only think i had to do was to create an item file for my temperature sensor with a simple line:

Number Temperature “Temperature [%1.f °C]” [ CurrentTemperature", “Celcius” ]

After that i’ve added openhab in Google Assistant and after the authorization my item added properly and works perfect! :slight_smile: