/** * @param $token */ public static function invalidate($token) { \JWTAuth::setToken($token); $payload = \JWTAuth::manager()->getJWTProvider()->decode($token); $userId = ArrayUtils::get($payload, 'user_id'); $exp = ArrayUtils::get($payload, 'exp'); static::removeTokenMap($userId, $exp); try { \JWTAuth::invalidate(); } catch (TokenExpiredException $e) { //If the token is expired already then do nothing here. The token map is already removed above. } }