I am using Firebase/JWT for my tokens. I have a function which will validate the token. If the token is invalid like expired it will throw an exception which i have no issue capturing if not part of SLIM framework. But if i move my code inside SLIM APP the Slim exception get called instead of my exception.
Is this by design or do i need to do something to avoid that ?
public function ValidateToken($token)
{
try {
$secretKey = base64_decode(SECRET_KEY);
$decoded = JWT::decode($token, $secretKey, array(‘HS256’));
$decoded_array = (array) $decoded;
return $decoded_array;
} catch (Exception $ex) {
return (array('validation_response' => array('Error' => $ex->getMessage())));
}
}