[myq] Remove the access token when the thing is removed (#14938)
* [myq] Remove the access token when the thing is removed * oAuthService.removeAccessTokenRefreshListener added Related to #14818 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
dea24b3dd8
commit
d3b7a0a98d
|
@ -162,10 +162,21 @@ public class MyQAccountHandler extends BaseBridgeHandler implements AccessTokenR
|
|||
stopPolls();
|
||||
OAuthClientService oAuthService = this.oAuthService;
|
||||
if (oAuthService != null) {
|
||||
oAuthService.close();
|
||||
oAuthService.removeAccessTokenRefreshListener(this);
|
||||
oAuthFactory.ungetOAuthService(getThing().toString());
|
||||
this.oAuthService = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRemoval() {
|
||||
OAuthClientService oAuthService = this.oAuthService;
|
||||
if (oAuthService != null) {
|
||||
oAuthFactory.deleteServiceAndAccessToken(getThing().toString());
|
||||
}
|
||||
super.handleRemoval();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends ThingHandlerService>> getServices() {
|
||||
return Collections.singleton(MyQDiscoveryService.class);
|
||||
|
|
Loading…
Reference in New Issue