From 52fe4c13028f9b1489bc2b0e8402ab92c0b3fdfa Mon Sep 17 00:00:00 2001 From: Sean Date: Sun, 30 Nov 2014 13:01:07 +0000 Subject: [PATCH] fixing issue --- src/Tymon/JWTAuth/Providers/FirebaseProvider.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Tymon/JWTAuth/Providers/FirebaseProvider.php b/src/Tymon/JWTAuth/Providers/FirebaseProvider.php index 84baf4e6e..150671a07 100644 --- a/src/Tymon/JWTAuth/Providers/FirebaseProvider.php +++ b/src/Tymon/JWTAuth/Providers/FirebaseProvider.php @@ -45,10 +45,12 @@ public function decode($token) try { $payload = (array) Firebase::decode($this->token, $this->secret); } catch (Exception $e) { - // ignore firebase's expired exception because we will throw our own later - if ($e->getMessage() !== 'Expired Token') { - throw new JWTException('Could not decode token: ' . $e->getMessage()); - } + // firebase implementation doesn't return the payload if it has expired :( + if ($e->getMessage() === 'Expired Token') { + throw new TokenExpiredException('JWT has expired'); + } else { + throw new JWTException('Could not decode token: ' . $e->getMessage()); + } } return $this->createPayload($payload);