title: Wrong Tasklist ID from Google Tasks API
body: <p>Spent hours and cannot seem to understand what went wrong with my Google Tasks API.</p>
  <ol>
  <li>Created new project in GCP</li>
  <li>Enable Google Tasks API</li>
  <li>Added a key and downloaded services-account.json</li>
  <li>Using the official Google Client PHP library</li>
  <li>Managed to authenticate and getting a response from Google Tasks API.</li>
  </ol>
  <p>But it doesn't return the correct Google Tasks and Tasklist ID from my account.</p>
  <p>The response returned the ID value which I validated with the Google Tasks API Resource - Try this API and the ID inputted resulted Invalid ID. Tried with the Try this API and authenticate my account and the Task ID is not the same with what I got from the Google Client PHP library.</p>
  <p>Hoping someone can shed some lights. Thanks in advance.</p>
  <pre><code>public function google_test() {
      $client = new Google\Client();
      $token = plugin_dir_path( __FILE__ ) . 'credentials.json';
      $client-&gt;setApplicationName('Google Tasks API PHP Quickstart');
  $client-&gt;setScopes(Google_Service_Tasks::TASKS_READONLY);
      $client-&gt;setAuthConfig( $token );
  
      // Get the API client and construct the service object.
      $service = new Google_Service_Tasks($client);
  
      // Print the first 10 task lists.
      $optParams = array(
        'maxResults' =&gt; 99,
      );
      $results = $service-&gt;tasklists-&gt;listTasklists($optParams);
  
      foreach ($results-&gt;getItems() as $tasklist) {
          $tasklist_id = $tasklist-&gt;getId();
          $tasks = $service-&gt;tasks-&gt;listTasks($tasklist_id, $optParams);
          $all_tasks[]        = $tasks-&gt;getItems();
  }
      return $all_tasks;
  }
  </code></pre>
  <p>Payload returned</p>
  <blockquote>
  <p>O:30:&quot;Google_Service_Tasks_TaskLists&quot;:10:{s:17:&quot;�<em>�collection_key&quot;;s:5:&quot;items&quot;;s:4:&quot;etag&quot;;s:17:&quot;&quot;LTE2NTQyOTQ1NDc&quot;&quot;;s:12:&quot;�</em>�itemsType&quot;;s:29:&quot;Google_Service_Tasks_TaskList&quot;;s:16:&quot;�<em>�itemsDataType&quot;;s:5:&quot;array&quot;;s:4:&quot;kind&quot;;s:15:&quot;tasks#taskLists&quot;;s:13:&quot;nextPageToken&quot;;N;s:25:&quot;�</em>�internal_gapi_mappings&quot;;a:0:{}s:12:&quot;�<em>�modelData&quot;;a:0:{}s:12:&quot;�</em>�processed&quot;;a:0:{}s:5:&quot;items&quot;;a:1:{i:0;O:29:&quot;Google_Service_Tasks_TaskList&quot;:9:{s:4:&quot;etag&quot;;s:16:&quot;&quot;MTg1ODI2Mzc1MQ&quot;&quot;;s:2:&quot;id&quot;;s:32:&quot;MTgxMDkzOTg1ODk3OTkzMTUxODI6MDow&quot;;s:4:&quot;kind&quot;;s:14:&quot;tasks#taskList&quot;;s:8:&quot;selfLink&quot;;s:84:&quot;https://www.googleapis.com/tasks/v1/users/@me/lists/MTgxMDkzOTg1ODk3OTkzMTUxODI6MDow&quot;;s:5:&quot;title&quot;;s:8:&quot;My Tasks&quot;;s:7:&quot;updated&quot;;s:24:&quot;2021-03-26T13:39:27.312Z&quot;;s:25:&quot;�<em>�internal_gapi_mappings&quot;;a:0:{}s:12:&quot;�</em>�modelData&quot;;a:0:{}s:12:&quot;�*�processed&quot;;a:0:{}}}}</p>
  </blockquote>
  <p>Google Tasks API Explorer</p>
  <blockquote>
  <p>{
  &quot;kind&quot;: &quot;tasks#taskLists&quot;,
  &quot;etag&quot;: &quot;&quot;LTExMDA5MDAxOQ&quot;&quot;,
  &quot;items&quot;: [
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;MDgyMDgxNjM3NzQxMDkxMjA0Mzk6MDow&quot;,
  &quot;etag&quot;: &quot;&quot;MTg1NTU3NTU1OQ&quot;&quot;,
  &quot;title&quot;: &quot;My Tasks&quot;,
  &quot;updated&quot;: &quot;2021-03-26T12:54:38.480Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/MDgyMDgxNjM3NzQxMDkxMjA0Mzk6MDow&quot;
  },
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;SldJSG1BUU53RjFmRkRlMg&quot;,
  &quot;etag&quot;: &quot;&quot;MTg0NDkwMTM4Nw&quot;&quot;,
  &quot;title&quot;: &quot;Jazlyn's Tasks&quot;,
  &quot;updated&quot;: &quot;2021-03-26T09:56:44.308Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/SldJSG1BUU53RjFmRkRlMg&quot;
  },
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;Y1JNZUtBUDJXb1psMk5WNg&quot;,
  &quot;etag&quot;: &quot;&quot;LTIzMTA5MjU2MQ&quot;&quot;,
  &quot;title&quot;: &quot;Anneke's Tasks&quot;,
  &quot;updated&quot;: &quot;2021-03-02T09:16:51.047Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/Y1JNZUtBUDJXb1psMk5WNg&quot;
  },
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;M0ozM2VjekRWdDBYaHVuMA&quot;,
  &quot;etag&quot;: &quot;&quot;MzY4Njg4NTM2&quot;&quot;,
  &quot;title&quot;: &quot;Richard's Tasks&quot;,
  &quot;updated&quot;: &quot;2021-03-09T07:53:11.425Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/M0ozM2VjekRWdDBYaHVuMA&quot;
  },
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;NjlpcFpUVm5iYy02M2o1Sg&quot;,
  &quot;etag&quot;: &quot;&quot;MTQxNzA5OTA3Nw&quot;&quot;,
  &quot;title&quot;: &quot;Calvin's Tasks&quot;,
  &quot;updated&quot;: &quot;2021-03-21T11:06:42.142Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/NjlpcFpUVm5iYy02M2o1Sg&quot;
  },
  {
  &quot;kind&quot;: &quot;tasks#taskList&quot;,
  &quot;id&quot;: &quot;c184LVhIZXB3N0Zva1Jndg&quot;,
  &quot;etag&quot;: &quot;&quot;MTg1NTg0MDAzNg&quot;&quot;,
  &quot;title&quot;: &quot;Test&quot;,
  &quot;updated&quot;: &quot;2021-03-26T12:59:03.165Z&quot;,
  &quot;selfLink&quot;: &quot;https://www.googleapis.com/tasks/v1/users/@me/lists/c184LVhIZXB3N0Zva1Jndg&quot;
  }
  ]
  }</p>
  </blockquote>