models/User.php
public static function isAccessTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $data = Yii::$app->jwt->getValidationData(); // It will use the current time to validate (iat, nbf and exp)
        $data->setIssuer(Yii::getAlias("@restIssuer"));
        $data->setAudience(Yii::getAlias("@restAudience"));
        $data->setId(Yii::getAlias("@restId")+strtotime(date('Y-m-d',time())), true);
        if (is_string($token))
            $token = Yii::$app->jwt->getParser()->parse($token);

        return $token->validate($data);
    }
public static function isAccessTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $data = Yii::$app->jwt->getValidationData(); // It will use the current time to validate (iat, nbf and exp)
        $data->setIssuer(Yii::getAlias("@restIssuer"));
        $data->setAudience(Yii::getAlias("@restAudience"));
        $data->setId(Yii::getAlias("@restId")+strtotime(date('Y-m-d',time())), true);
        if (is_string($token))
            $token = Yii::$app->jwt->getParser()->parse($token);

        return $token->validate($data);
    }
public static function isAccessTokenValid ( $ token ) { if ( empty ( $ token ) ) { return false ; } $ data = Yii :: $ app -> jwt -> getValidationData ( ) ; // It will use the current time to validate (iat, nbf and exp) $ data -> setIssuer ( Yii :: getAlias ( "@restIssuer" ) ) ; $ data -> setAudience ( Yii :: getAlias ( "@restAudience" ) ) ; $ data -> setId ( Yii :: getAlias ( "@restId" ) + strtotime ( date ( 'Y-m-d' , time ( ) ) ) , true ) ; if ( is_string ( $ token ) ) $ token = Yii :: $ app -> jwt -> getParser ( ) -> parse ( $ token ) ; return $ token -> validate ( $ data ) ; }
Validates access_token.

@param string $token token to validate

@return bool if token provided is valid for current user
Validates access_token .