title: How to use JWT in Yii2 project?
body: <p>In my REST API i want to use JWT fro Authorization.</p>
  
  <p>So, I include this extension - <a href="https://github.com/sizeg/yii2-jwt" rel="noreferrer">https://github.com/sizeg/yii2-jwt</a></p>
  
  <p>It clear how to create JWT token, but how to validate Token in API side ? I heart, i must use two tokens - auth_token and refresh_token. For what? What different when i whatt to validate and check user ?</p>
  
  <p>I mean - ok, when i receive username and password, I create auth_token (JWT) and update token in users DB, after i return token to frontend. </p>
  
  <p>After frontend will send auth token in each request, and I will validate token and check user in users DB and check access etc.   How to realize refresh token and for what? </p>
  
  <p>For example my controller:</p>
  
  <pre><code>class UploadController extends Controller {
  
      public $serializer = [
          'class' =&gt; 'yii\rest\Serializer',
          'collectionEnvelope' =&gt; 'items',
      ];
  
      public function behaviors()
      {
          $behaviors = parent::behaviors();
  
          $behaviors['authenticator'] = [
              'class' =&gt; JwtHttpBearerAuth::className()
          ];
  
          return $behaviors;
      }
  
      public function actionIndex() {
  
         //Work with User
      }
  }
  </code></pre>
  
  <p>And how to get token from headers ? </p>