Skip to content

Commit

Permalink
fix refresh flow
Browse files Browse the repository at this point in the history
  • Loading branch information
SanterreJo committed Apr 12, 2024
1 parent 666d60e commit d986432
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/hiloApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ async function login() {
getLogger().debug("Logging in");
const config = getConfig();
const newRefreshToken = config.refreshToken;
if (refreshToken === newRefreshToken) {
throw new Error(
"Unable to login. Please try to refresh your login credentials by using the 'Login with Hilo' button in the plugin configuration in homebridge UI"
);
}
renewTokens({
newRefreshToken,
});
Expand Down Expand Up @@ -115,11 +110,7 @@ export async function setupAutoRefreshToken(expiresIn: number | undefined) {
try {
await refreshTokenRequest();
} catch (e) {
try {
await login();
} catch (e) {
unableToLogin(e);
}
unableToLogin(e);
}
} else {
getLogger().debug("Setting up auto refresh token");
Expand Down

0 comments on commit d986432

Please sign in to comment.