diff --git a/E-Stores-API/src/main/java/com/devb/estores/serviceimpl/AuthServiceImpl.java b/E-Stores-API/src/main/java/com/devb/estores/serviceimpl/AuthServiceImpl.java index 6961535..826fbce 100644 --- a/E-Stores-API/src/main/java/com/devb/estores/serviceimpl/AuthServiceImpl.java +++ b/E-Stores-API/src/main/java/com/devb/estores/serviceimpl/AuthServiceImpl.java @@ -223,7 +223,8 @@ public AuthResponse refreshLogin(String refreshToken, String accessToken) { } private long getLeftOverSeconds(long expiryDuration, Date tokenExpiration) { - return expiryDuration - ((new Date().getTime() - tokenExpiration.getTime()) / 1000); + long remainingSeconds = (tokenExpiration.getTime() - new Date().getTime()) / 1000; + return Math.max(remainingSeconds, 0); } @Override