[ecowatt] Remove the access token when the thing is removed (#14934)
Related to #14818 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
4e8e39cd9f
commit
831a7af2c6
|
@ -116,6 +116,15 @@ public class EcowattHandler extends BaseThingHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRemoval() {
|
||||||
|
EcowattRestApi localApi = api;
|
||||||
|
if (localApi != null) {
|
||||||
|
localApi.deleteServiceAndAccessToken();
|
||||||
|
}
|
||||||
|
super.handleRemoval();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedule the next update of channels.
|
* Schedule the next update of channels.
|
||||||
*
|
*
|
||||||
|
|
|
@ -140,4 +140,8 @@ public class EcowattRestApi {
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
oAuthFactory.ungetOAuthService(authServiceHandle);
|
oAuthFactory.ungetOAuthService(authServiceHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteServiceAndAccessToken() {
|
||||||
|
oAuthFactory.deleteServiceAndAccessToken(authServiceHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue