diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableAuthManager.java b/iterableapi/src/main/java/com/iterable/iterableapi/IterableAuthManager.java index c52e23771..562e86bd7 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableAuthManager.java +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableAuthManager.java @@ -156,6 +156,10 @@ public void run() { private static long decodedExpiration(String encodedJWT) throws Exception { long exp = 0; String[] split = encodedJWT.split("\\."); + //Check if jwt is valid + if (split.length != 3) { + throw new IllegalArgumentException("Invalid JWT"); + } String body = getJson(split[1]); JSONObject jObj = new JSONObject(body); exp = jObj.getLong(expirationString);