original_string: public function generateAccessToken()
      {
  
          // $this->access_token = Yii::$app->security->generateRandomString() . '_' . time();
          $signer = new Sha256();
          $token = Yii::$app->jwt->getBuilder()->setIssuer(Yii::getAlias("@restIssuer"))// Configures the issuer (iss claim)
          ->setAudience(Yii::getAlias("@restAudience"))// Configures the audience (aud claim)
          ->setId(Yii::getAlias("@restId")+ strtotime(date('Y-m-d',time())), true)
              ->setExpiration(time() + Yii::$app->params['accessTokenExpire'])// Configures exp time
              ->setIssuedAt(time())// Configures the time that the token was issue (iat claim)
  
              ->sign($signer, Yii::$app->jwt->key)
              ->getToken(); // Retrieves the generated token
          //$this->auth_key=$this->id;
          $this->access_token = (string)$token;
      }
code: public function generateAccessToken()
      {
  
          // $this->access_token = Yii::$app->security->generateRandomString() . '_' . time();
          $signer = new Sha256();
          $token = Yii::$app->jwt->getBuilder()->setIssuer(Yii::getAlias("@restIssuer"))// Configures the issuer (iss claim)
          ->setAudience(Yii::getAlias("@restAudience"))// Configures the audience (aud claim)
          ->setId(Yii::getAlias("@restId")+ strtotime(date('Y-m-d',time())), true)
              ->setExpiration(time() + Yii::$app->params['accessTokenExpire'])// Configures exp time
              ->setIssuedAt(time())// Configures the time that the token was issue (iat claim)
  
              ->sign($signer, Yii::$app->jwt->key)
              ->getToken(); // Retrieves the generated token
          //$this->auth_key=$this->id;
          $this->access_token = (string)$token;
      }
code_tokens: public function generateAccessToken ( ) { // $this->access_token = Yii::$app->security->generateRandomString() . '_' . time(); $ signer = new Sha256 ( ) ; $ token = Yii :: $ app -> jwt -> getBuilder ( ) -> setIssuer ( Yii :: getAlias ( "@restIssuer" ) ) // Configures the issuer (iss claim) -> setAudience ( Yii :: getAlias ( "@restAudience" ) ) // Configures the audience (aud claim) -> setId ( Yii :: getAlias ( "@restId" ) + strtotime ( date ( 'Y-m-d' , time ( ) ) ) , true ) -> setExpiration ( time ( ) + Yii :: $ app -> params [ 'accessTokenExpire' ] ) // Configures exp time -> setIssuedAt ( time ( ) ) // Configures the time that the token was issue (iat claim) -> sign ( $ signer , Yii :: $ app -> jwt -> key ) -> getToken ( ) ; // Retrieves the generated token //$this->auth_key=$this->id; $ this -> access_token = ( string ) $ token ; }
docstring: Generates new api access token.
docstring_tokens: Generates new api access token .