Skip to content

Commit

Permalink
[ecowatt] Remove the access token when the thing is removed
Browse files Browse the repository at this point in the history
Related to #14818

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
  • Loading branch information
lolodomo committed May 5, 2023
1 parent 58470ca commit 984fb4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ public void dispose() {
}
}

@Override
public void handleRemoval() {
EcowattRestApi localApi = api;
if (localApi != null) {
localApi.deleteServiceAndAccessToken();
}
super.handleRemoval();
}

/**
* Schedule the next update of channels.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,8 @@ private AccessTokenResponse authenticate() throws CommunicationException {
public void dispose() {
oAuthFactory.ungetOAuthService(authServiceHandle);
}

public void deleteServiceAndAccessToken() {
oAuthFactory.deleteServiceAndAccessToken(authServiceHandle);
}
}

0 comments on commit 984fb4c

Please sign in to comment.