diff --git a/build.gradle b/build.gradle index 2a276ff1..915f886f 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ subprojects { apply plugin: 'java-library' dependencies { - implementation 'se.koc:zutil:1.0.304' + implementation 'se.koc:zutil:1.0.306' //implementation 'se.koc:zutil:1.0.0-SNAPSHOT' testImplementation 'junit:junit:4.12' diff --git a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java index 39b36f4b..ff331b04 100644 --- a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java +++ b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java @@ -25,6 +25,7 @@ import com.google.protobuf.Struct; import com.google.protobuf.Value; import org.json.JSONObject; import se.hal.HalContext; +import se.hal.HalServer; import se.hal.intf.HalAbstractDevice; import se.hal.plugin.assistant.google.trait.DeviceTrait; import se.hal.plugin.assistant.google.trait.DeviceTraitFactory; @@ -58,6 +59,13 @@ public class SmartHomeImpl extends SmartHomeApp implements OAuth2TokenRegistrati userAgent = HalContext.getStringProperty(CONFIG_USER_AGENT); clientId = HalContext.getStringProperty(SmartHomeDaemon.CONFIG_CLIENT_ID); + for (String token : HalServer.getExternalWebDaemon().getOAuth2Registry().getAccessTokens(clientId)) { + if (HalServer.getExternalWebDaemon().getOAuth2Registry().isAccessTokenValid(token)) { + onTokenRegistration(clientId, + token, + HalServer.getExternalWebDaemon().getOAuth2Registry().getAccessTokenTimeout(token)); + } + } }