Adding the apiKey validation inside the try catch to catch runtime exceptions
with malformed tokens