openhab-core: [oauth] Error fetching access token. Invalid oauth code? Please generate a new one.
I am running on a Windows 10 PC:
Operating system: Windows 10/10.0 (amd64) Java Runtime: Azul Systems, Inc. 17.0.6 (Zulu17.40+19-CA)
Since upgrading from 3.4.2 to 4.0.0-SNAPSHOT and now 4.0.0.M1 I am getting errors trying to authenticate for Google TTS:
Error fetching access token. Invalid oauth code? Please generate a new one.
When logged using TRACE logging:
log:set TRACE org.openhab.voice.googletts
log:set TRACE org.openhab.core.auth.oauth2client
I get:
11:22:33.943 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : ConfigurableComponentHolder configuration updated for pid org.openhab.voice.googletts with change count 61
11:22:33.944 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : Querying state active
11:22:33.945 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : Querying state active
11:22:33.945 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : invoking modified: updateConfig: parameters [org.apache.felix.scr.impl.helper.ReadOnlyDictionary]
11:22:33.946 [DEBUG] [e.googletts.internal.GoogleTTSService] - Updating configuration
11:22:33.946 [TRACE] [e.googletts.internal.GoogleTTSService] - New configuration: GoogleTTSConfig{pitch=0.0, speakingRate=1.0, volumeGainDb=0.0, purgeCache=true}
11:22:33.947 [DEBUG] [ice.googletts.internal.GoogleCloudAPI] - Trying to get access and refresh tokens.
11:22:34.122 [DEBUG] [.oauth2client.internal.OAuthConnector] - Oauth request parameter grant_type, value authorization_code
11:22:34.123 [DEBUG] [.oauth2client.internal.OAuthConnector] - Oauth request parameter code, value <REDACT>
11:22:34.124 [DEBUG] [.oauth2client.internal.OAuthConnector] - Oauth request parameter redirect_uri, value https://www.google.com
11:22:34.124 [DEBUG] [.oauth2client.internal.OAuthConnector] - Setting authentication for clientId <REDACT> Using basic auth false
11:22:35.564 [DEBUG] [ice.googletts.internal.GoogleCloudAPI] - Error fetching access token: Exception in oauth communication, grant type authorization_code
org.openhab.core.auth.client.oauth2.OAuthException: Exception in oauth communication, grant type authorization_code
at org.openhab.core.auth.oauth2client.internal.OAuthConnector.doRequest(OAuthConnector.java:331) ~[?:?]
at org.openhab.core.auth.oauth2client.internal.OAuthConnector.grantTypeAuthorizationCode(OAuthConnector.java:220) ~[?:?]
at org.openhab.core.auth.oauth2client.internal.OAuthClientServiceImpl.getAccessTokenResponseByAuthorizationCode(OAuthClientServiceImpl.java:211) ~[?:?]
at org.openhab.voice.googletts.internal.GoogleCloudAPI.getAccessToken(GoogleCloudAPI.java:192) ~[?:?]
at org.openhab.voice.googletts.internal.GoogleCloudAPI.setConfig(GoogleCloudAPI.java:154) ~[?:?]
at org.openhab.voice.googletts.internal.GoogleTTSService.updateConfig(GoogleTTSService.java:240) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:245) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:687) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:531) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:317) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:856) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:810) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:725) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:686) ~[?:?]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:440) ~[?:?]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:347) ~[?:?]
at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$2.configurationEvent(RegionConfigurationSupport.java:115) ~[?:?]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:1723) ~[?:?]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:1664) ~[?:?]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:122) ~[?:?]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:84) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: com.google.gson.JsonIOException: Failed making field 'java.time.Instant#seconds' accessible; either change its visibility or write a custom TypeAdapter for its declaring type
at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:23) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[?:?]
at com.google.gson.Gson.getAdapter(Gson.java:531) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:137) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:211) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[?:?]
at com.google.gson.Gson.getAdapter(Gson.java:531) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1057) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1016) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:959) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:927) ~[?:?]
at org.openhab.core.auth.oauth2client.internal.OAuthConnector.doRequest(OAuthConnector.java:308) ~[?:?]
... 27 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.time.Instant.seconds accessible: module java.base does not "opens java.time" to unnamed module @72d10ef7
at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
at java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[?:?]
at java.lang.reflect.Field.setAccessible(Field.java:172) ~[?:?]
at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:20) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[?:?]
at com.google.gson.Gson.getAdapter(Gson.java:531) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:137) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:211) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[?:?]
at com.google.gson.Gson.getAdapter(Gson.java:531) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1057) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:1016) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:959) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:927) ~[?:?]
at org.openhab.core.auth.oauth2client.internal.OAuthConnector.doRequest(OAuthConnector.java:308) ~[?:?]
... 27 more
11:22:35.574 [WARN ] [ice.googletts.internal.GoogleCloudAPI] - Error initializing Google Cloud TTS service: Error fetching access token. Invalid authcode? Please generate a new one.
11:22:35.575 [DEBUG] [ice.googletts.internal.GoogleCloudAPI] - Cache purged.
11:22:35.576 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : invoked modified: updateConfig
11:22:35.577 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : No change in target property for dependency $000: currently registered: true
11:22:35.577 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : No change in target property for dependency $001: currently registered: true
11:22:35.578 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : No change in target property for dependency osgi.ds.satisfying.condition: currently registered: true
11:22:35.578 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : Querying state active
11:22:35.580 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : ImmediateComponentHolder Finished configuring the dependency managers for component for pid org.openhab.voice.googletts
11:22:35.581 [DEBUG] [e.googletts.internal.GoogleTTSService] - bundle org.openhab.voice.googletts:4.0.0.M1 (257)[org.openhab.voice.googletts.internal.GoogleTTSService(336)] : ImmediateComponentHolder Will not enable component for pid org.openhab.voice.googletts: holder enabled state: true, metadata enabled: true
I have retested with 3.4.2 (Java 11) and with a CLEAN 4.0.0-SNAPSHOT (only Google TTS installed) and both work fine.
Any assistance would be appreciated.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 33 (20 by maintainers)
Yes, I just restarted openHAB and it changed from WAITING. Thanks for all the help
I am so sorry!
When trying to test I uninstalled Google TTS and “reinstalled”. Turns out I installed STT instead. Really a rookie move!
I can confirm now that your fixed
org.openhab.core.auth.oauth2client-4.0.0-SNAPSHOT
- the latest one, has resolved my issue and I have managed to log in to Google TTS successfully.I retested with the M1 version and the error occurs - so your fix is definitely the solution. I also do not see the exceptions anymore.
Can you confirm that once your fixes are merged I would have to:
bundle:install org.openhab.core.auth.oauth2client
Again, thank you so much for taking the time to look at this and help me
Sorry, I’ve actually never used Google TTS (I use VoiceRSS). But I do have a Nest doorbell, and that binding had the same problem. So I ended up fixing it in both bindings.
@jlaur Yes, I do:
Tried again too: