title: REST Api with QueryParamAuth authenticator - Yii2
body: <p>I'm trying to create rest api for my application to get the data in my android app. This is my controller</p>
  
  <pre><code>&lt;?php
  
  namespace api\modules\v1\controllers;
  
  use yii\rest\ActiveController;
  use yii\filters\auth\QueryParamAuth;
  
  /**
   * Tk103 Controller API
   */
  class Tk103Controller extends ActiveController
  {
      public $modelClass = 'api\modules\v1\models\Tk103CurrentLocation';  
  
      public function behaviors()
      {
          $behaviors = parent::behaviors();
          $behaviors['authenticator'] = [
              'class' =&gt; QueryParamAuth::className(),
          ];
          return $behaviors;
      }  
  
  }
  </code></pre>
  
  <p>I added <code>access_token</code> column in my <strong>user</strong> table, implemented <code>findIdentityByAccessToken()</code> in User Model and calling this URL
  <a href="http://localhost:7872/api/v1/tk103s?access-token=abcd" rel="nofollow">http://localhost:7872/api/v1/tk103s?access-token=abcd</a></p>
  
  <p>This is working great and returning data if and only if <code>access_token</code> matches with any <strong>single user</strong> in the table. 
  I checked <a href="https://github.com/yiisoft/yii2/blob/master/framework/filters/auth/QueryParamAuth.php" rel="nofollow">QueryParamAuth</a> class and found that <code>QueryParamAuth::authenticate()</code> returns <code>$identity</code> after successful authentication.</p>
  
  <p>Currently this url is returning whole data of my table. </p>
  
  <p>What I want is(after authentication):</p>
  
  <ol>
  <li>Get user id/username of the requester.</li>
  <li>Based on that id/username, the data related to him as per relations of tables in db. (currently whole rows are being returned but I want only few that are matching with the current requester/user)</li>
  </ol>
  
  <p>I tried but didn't getting any clue to catch returned <code>$identity</code> of user after authentication. 
  And I know it is possible too to make this work. Help me out folks to create magic.</p>