Skip to content

Commit

Permalink
fixing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tymondesigns committed Nov 30, 2014
1 parent fe4a615 commit 52fe4c1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Tymon/JWTAuth/Providers/FirebaseProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 52fe4c1

Please sign in to comment.