diff --git a/lib/geo_therminator/pump_api/auth/server.ex b/lib/geo_therminator/pump_api/auth/server.ex index b89fdd8..cccb2ca 100644 --- a/lib/geo_therminator/pump_api/auth/server.ex +++ b/lib/geo_therminator/pump_api/auth/server.ex @@ -79,8 +79,12 @@ defmodule GeoTherminator.PumpAPI.Auth.Server do if diff < @token_check_diff do Logger.debug("Renewing auth token since #{diff} < #{@token_check_diff}") - user = Auth.API.auth(state.username, state.password) - {:noreply, %State{state | authed_user: user}} + + with {:ok, user} <- Auth.API.auth(state.username, state.password) do + {:noreply, %State{state | authed_user: user}} + else + _ -> {:noreply, state} + end else {:noreply, state} end