Hi,
I’m migrating from OH2 to OH3. In OH2 I had Google TTS working for years.
Now I can’t get it to work. I’ve followed the instructions in Google Cloud Text-to-Speech - Voices | openHAB to obtain the web app credentials (I had the credentials for OH2, which were for desktop type). The project is named “openHAB”.
But when I try to get the authorization code, the Google account selection page prompts me to select a Google account (I have several) to access a project named “Quickstart”, not “openHAB”. Quickstart is another GCP I have.
If I continue and get the authorization code, I get the following error starting OH3 (which I find normal, since the authorization code is for a different project):
2022-12-16 22:54:11.117 [ERROR] [oauth2client.internal.OAuthConnector] - grant type authorization_code to URL https://accounts.google.com/o/oauth2/token failed with error code invalid_grant, description Bad Request
2022-12-16 22:54:11.124 [WARN ] [ce.googletts.internal.GoogleCloudAPI] - Error initializing Google Cloud TTS service: Error fetching access token. Invalid authcode? Please generate a new one.
How can I specify the project in the URL to request the authorization code?
Thank you.
I already had a project created with the TTS API enabled in Google Cloud, because I had it working in OH2. This project is called “openHAB”.
I already had credentials for this project for OH2, but they were desktop type (“OAuth client”). Yesterday, following the instructions for OH3 I created the web app credentials (“TTS openHAB”):
I continue and I get the authorization code from de parameter in the URL. It is what I copy in org.openhab.voice.googletts:authcode=MY_AUTH_CODE in services/googletts.cfg and appears in the web GUI.
But then I restart openHAB and I get the error and the waring in the log.
I believe I have a problem retrieving the authorization code because the name of the project that appears in the account selection and the permission granting pages is “Quickstart”, but it should be “openHAB”. Is this correct? Am I doing something wrong?
Thank you very much.
All I can say is that I thoroughly documented the steps and I lately recreated everything from scratch (and it worked well) to make sure the steps I documented work out correctly. I would recommend to start from scratch exactly how I wrote it. Otherwise we would have to check were you diverted from that (at least you edited files on the server which I haven’t documented in my steps).
Hi,
With the configuration in files I got it to accept the authentication code but I had no voices listed in the karaf console.
I started from scratch from the GUI and now it’s all working. I’m going to leave it like this, I’m tired of fiddling with this.
Thank you very much for your help!!!
Recently upgraded OH from 3.3 to 3.4.2. but still after OH restart Google TTS stop working …Maybe someone know when issue with authcode wil be fixed? When I generate new authcode it is working till restart…
Is this with config from text files or via UI?
While I prefer config by text files myself I found that refreshing the auth token seems to fail with config files. Google TTS is about the only thing I config via the UI for that reason.
That said, I still have to create a new auth code once or twice a week, oauth2.0 with Google is a fragile affair and all the irritating dialogs and warnngs on top of it - not for the faint of heart.
Hi @rubens ,
My Openhab config is 100% pure textual. This way a have easy way to have config versioning etc. I don’t see any benefits with UI config,my main ui is sitemap file
If there will be no fix for Google TTS then I am planning switch back to OH 2.5
Apparently Google changed the oauth2 structeres again. When creating credentials, one can not select an application type. Also “Authorized redirect URIs” does not accept “https://www.google.com” anymore. I can not find a solution.
Many thanks for all these tutorials and guidelines. I followed all of them.
But I struggle since several time to get it to work. I already tried it with “Web Application”, then I get a token.
But it won’t work. Now, I want to try it with “Desktop Application”
But here I get the following error from Google:
Wrong request…
But there is no Redirect URI in Desktop mode.
Is propably another TTS Service easier to handle?
Many thanks