diff --git a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2AuthorizationCode.java b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2AuthorizationCode.java index 60b0f8a368..4c2de06b2e 100644 --- a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2AuthorizationCode.java +++ b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2AuthorizationCode.java @@ -142,9 +142,9 @@ public class OAuth2AuthorizationCode extends APIConnection implements UpdatableC Object expiresInResponse = mappedResponse.get(Authentication.EXPIRES_IN); Instant expiresAt = null; if (expiresAtResponse != null) { - expiresAt = Instant.ofEpochSecond(Long.valueOf((Integer) expiresAtResponse)); + expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse))); } else if (expiresInResponse != null) { - expiresAt = issuedAt.plusSeconds(Long.valueOf((Integer) expiresInResponse)); + expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse))); } authenticationResponse.setExpiresAt(expiresAt); authenticationResponse.setIssuedAt(issuedAt); diff --git a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2ClientCredentials.java b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2ClientCredentials.java index 7ab38c825e..542936096e 100644 --- a/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2ClientCredentials.java +++ b/app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/connections/OAuth2ClientCredentials.java @@ -111,9 +111,9 @@ public class OAuth2ClientCredentials extends APIConnection implements UpdatableC Object expiresInResponse = mappedResponse.get(Authentication.EXPIRES_IN); Instant expiresAt = null; if (expiresAtResponse != null) { - expiresAt = Instant.ofEpochSecond(Long.parseLong((String) expiresAtResponse)); + expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse))); } else if (expiresInResponse != null) { - expiresAt = issuedAt.plusSeconds(Long.valueOf((Integer) expiresInResponse)); + expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse))); } authenticationResponse.setExpiresAt(expiresAt); authenticationResponse.setIssuedAt(issuedAt); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java index ca06edb7f7..c69441dbe6 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java @@ -230,9 +230,9 @@ public class AuthenticationServiceCEImpl implements AuthenticationServiceCE { Object expiresInResponse = response.get(Authentication.EXPIRES_IN); Instant expiresAt = null; if (expiresAtResponse != null) { - expiresAt = Instant.ofEpochSecond(Long.valueOf((Integer) expiresAtResponse)); + expiresAt = Instant.ofEpochSecond(Long.parseLong(String.valueOf(expiresAtResponse))); } else if (expiresInResponse != null) { - expiresAt = issuedAt.plusSeconds(Long.parseLong((String) expiresInResponse)); + expiresAt = issuedAt.plusSeconds(Long.parseLong(String.valueOf(expiresInResponse))); } authenticationResponse.setExpiresAt(expiresAt); // Replacing with returned scope instead