title: How to disable sessions, cookies and auto login in Yii2?
body: <p>I am building stateless restfull API in Yii2. So I created new APP in my advanced app layout (as preferred by Yii2 creators) and configure all necessary things and API worked.</p>
  
  <p>Now I want to make it stateless - I want to disable session and I want it to be accomplished in <code>config/main.php</code> inside my API app to ensure it as global setting.</p>
  
  <p>Also I want to disable cookies and auto login.</p>
  
  <p>What I have been playing now so far is inside Module class</p>
  
  <pre><code>&lt;?php
  namespace api\modules\v1;
  
  use \app\models\User;
  use yii\filters\auth\HttpBasicAuth;
  
  class Module extends \yii\base\Module
  {
      ...
      public function init()
      {
          parent::init();        
          \Yii::$app-&gt;user-&gt;enableSession = false;
          \Yii::$app-&gt;user-&gt;enableAutoLogin = false;
        }
      ...
  }
  </code></pre>
  
  <p>But when trying to access data using POSTMAN on Chrome I can see that: </p>
  
  <ul>
  <li>Cookies are set (PHPSESSID, _csrf, _identity)</li>
  <li>I always get popup asking for username and password</li>
  </ul>
  
  <p>Thanks for your help in advance!</p>