title: laravel passport + scopes token is invalid because its size is too big
body: <p>I have problem in <strong>scopes</strong> =&gt;</p>
  <blockquote>
  <p>the browser show me this error when i try login :</p>
  <p><code>Cookie “token” is invalid because its size is too big. Max size is 4096 B.</code></p>
  </blockquote>
  <p>And when i search for problem i realise that :</p>
  <p>When you make a new scope and attach it to user , <strong>your token will be more bigger</strong></p>
  <p>I using alot of scops ( scopes for <strong>every action</strong> in app )</p>
  <hr />
  <h3>AuthServiceProvider.php</h3>
  <pre class="lang-php prettyprint-override"><code>class AuthServiceProvider extends ServiceProvider {
  
      /**
       * The policy mappings for the application.
       *
       * @var array
       */
      protected $policies
          = [
              'App\Models\Model' =&gt; 'App\Policies\ModelPolicy',
          ];
  
      /**
       * Register any authentication / authorization services.
       *
       * @return void
       */
      public function boot() {
          $this-&gt;registerPolicies();
          if ( ! $this-&gt;app-&gt;routesAreCached() ) {
              Passport::routes();
          }
  
  
          $scope_controller = new ScopeController();
          $scopes           = $scope_controller-&gt;get();
  
          Passport::tokensCan( $scopes );
  
      }
  }
  
  </code></pre>
  <h3>ScopeController.php</h3>
  <pre class="lang-php prettyprint-override"><code>class ScopeController extends Controller
  {
      public function get(): array
      {
          if (Schema::hasTable('permission_scopes')) {
              $scopes = PermissionScope::all()-&gt;toArray();
              $scopes_array = [];
              foreach ($scopes as $key =&gt; $scope) {
                  $scopes_array[$scope['value']] = $scope['description'];
              }
              return $scopes_array;
          }
          return [];
      }
  }
  
  
  </code></pre>
  <h3>permission_scopes table</h3>
  <p><a href="https://i.stack.imgur.com/ltZ9H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ltZ9H.png" alt="enter image description here" /></a></p>
  <h3>Login method</h3>
  <pre class="lang-php prettyprint-override"><code> public function generateToken(User $user, string $name = 'default_token'): object
      {
          $scopes = $this-&gt;getScopes($user); // this methode gets scopes
          $obj_token = $user-&gt;createToken($name, $scopes); // and this one generate the token 
          $access_token = $obj_token-&gt;accessToken; // token is ready here  ** but its to BIG **
          $expiration = $obj_token-&gt;token-&gt;expires_at;
          return (object)['token' =&gt; $access_token, 'expiration' =&gt; $expiration];
      }
  </code></pre>
  <blockquote>
  <p>where is my problem and how can i fix it ?</p>
  </blockquote>