diff --git a/bundles/org.openhab.binding.webexteams/src/main/java/org/openhab/binding/webexteams/internal/WebexTeamsHandler.java b/bundles/org.openhab.binding.webexteams/src/main/java/org/openhab/binding/webexteams/internal/WebexTeamsHandler.java index b317f0c3f46..16eb61b14a2 100644 --- a/bundles/org.openhab.binding.webexteams/src/main/java/org/openhab/binding/webexteams/internal/WebexTeamsHandler.java +++ b/bundles/org.openhab.binding.webexteams/src/main/java/org/openhab/binding/webexteams/internal/WebexTeamsHandler.java @@ -147,11 +147,17 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe OAuthClientService authService = this.authService; if (authService != null) { authService.removeAccessTokenRefreshListener(this); + oAuthFactory.ungetOAuthService(thing.getUID().getAsString()); } - oAuthFactory.ungetOAuthService(thing.getUID().getAsString()); cancelSchedulers(); } + @Override + public void handleRemoval() { + oAuthFactory.deleteServiceAndAccessToken(thing.getUID().getAsString()); + super.handleRemoval(); + } + private void createIntegrationOAuthClientService(WebexTeamsConfiguration config) { String thingUID = this.getThing().getUID().getAsString(); logger.debug("Creating OAuth Client Service for {}", thingUID); @@ -369,7 +375,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe /** * Send a message to a specific room - * + * * @param roomId roomId of the room to send to * @param msg markdown text string to be sent * @return true, if sending the message has been successful and @@ -385,11 +391,11 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe /** * Send a message to a specific room, with attachment - * + * * @param roomId roomId of the room to send to * @param msg markdown text string to be sent * @param attach URL of the attachment - * + * * @return true, if sending the message has been successful and * false in all other cases. */ @@ -404,7 +410,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe /** * Sends a message to a specific person, identified by email - * + * * @param personEmail email address of the person to send to * @param msg markdown text string to be sent * @return true, if sending the message has been successful and @@ -420,7 +426,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe /** * Sends a message to a specific person, identified by email, with attachment - * + * * @param personEmail email address of the person to send to * @param msg markdown text string to be sent * @param attach URL of the attachment* @@ -438,7 +444,7 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe /** * Sends a Message - * + * * @param msg the Message to be sent * @return true, if sending the message has been successful and * false in all other cases.