title: Routes going through api.php returning unauthorised whereas the same route going through web.php works
body: <p>I have a page which enables users to create 'folders'. I'm using the function below to getAll folders belonging to each user, so when a user logs in they should see all of their folders but not the folders of other users.</p>
  <pre><code>/**
   * Retrieve all user folders
   *
   * @return Response
   */
  public function getAll()
  {
      // notes associated to folder included
      return Folder::where('user_id', Auth::user()-&gt;id)-&gt;get();
  }
  </code></pre>
  <p>This is what the vue page used to load all folders looks like:</p>
  <pre><code>&lt;template&gt;
      &lt;v-app id=&quot;inspire&quot;&gt;
          &lt;v-card v-for=&quot;folder in folders&quot; :key=&quot;folder.id&quot;&gt;
              &lt;v-card-text&gt;
                  Name: {{ folder.name }}
              &lt;/v-card-text&gt;
          &lt;/v-card&gt;
      &lt;/v-app&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  import { mapState } from &quot;vuex&quot;;
  
  export default {
      computed: {
          ...mapState(['folders'])
      },
  
      mounted() {
          this.$store.dispatch('getAllFolders');
      }
  };
  &lt;/script&gt;
  </code></pre>
  <p>This is what the getAllFolders method looks like:</p>
  <pre><code>getAllFolders() {
      apiClient.get(window.routes['folders.getAll'])
      .then(function(response){
          console.log(response)
      })
      .catch(function(error){
          console.error(error);
      });
  },
  </code></pre>
  <p>Adding the route to web.php works and allows for each user to see their relevant folders:</p>
  <pre><code>Route::get('folders/get-all', 'FolderController@getAll')-&gt;name('folders.getAll');
  </code></pre>
  <p>However adding it to api.php leads to unauthorised errors:</p>
  <pre><code>  Route::middleware(['auth:api'])-&gt;group(function () {     
        Route::get('folders/get-all', 'FolderController@getAll')-&gt;name('folders.getAll');
        Route::apiResource('folders', FolderController::class);
  });
  </code></pre>
  <p><a href="https://i.stack.imgur.com/PZzfH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PZzfH.png" alt="enter image description here" /></a></p>
  <p>What might I be doing wrong?</p>