Google+ Sign-In: Cannot choose secondary YouTube accounts for authorized requests
<p>In order to make a request to <code>Youtube Data API</code>'s <code>youtube.channels.list</code> with the <code>mine</code> parameter set to <code>true</code>, I have to make a properly authorized request, i.e. I need to provide a token that is bound to that channel.</p>

<p>In order to get that token, I use the Google client library from here:</p>

<pre><code>&lt;script src="//apis.google.com/js/client:platform.js"&gt;&lt;/script&gt;
</code></pre>

<p>that enables me to make authentication requests on behalf of a certain Google account.</p>

<p>With this in mind, I have this code:</p>

<pre><code>var parameters = {
  'clientid': 'CLIENT_ID',
  'scope': 'https://www.googleapis.com/auth/plus.profile.emails.read https://www.googleapis.com/auth/youtube.readonly',
  'cookiepolicy': 'single_host_origin',
  'include_granted_scopes': true,
  'callback': 'googleLogin'
};

gapi.auth.signIn(parameters);

...

window.googleLogin = (authResult) =&gt; {
  if (authResult[ 'error' ] == 'immediate_failed') return;

  if (authResult[ 'status' ][ 'signed_in' ]) {
    // make GET request to https://www.googleapis.com/youtube/v3/channels?part=contentDetails&amp;mine=true
    // with Authorization header `Bearer ${gapi.auth.getToken().access_token}`        
  } else {
    console.log("singned out");
  }
};
</code></pre>

<p>Now the problem is that after I choose my Google Account and let's say Youtube Account no. 2, I get the results as if I had chosen the main Youtube account.</p>

<p>So the problem here is that the <strong>token</strong> that I get from <code>gapi.auth</code> doesn't consider, in any way, what Youtube account I choose and it always generates tokens for the main account (no. 1).</p>

<ul>
<li>I tried signing out before singing in, but doesn't do anything.</li>
<li>I've also tried using gapi.auth2, but with this one I get another annoying behaviour that I've described here: <a href="https://stackoverflow.com/questions/37951665/gapi-auth2-gives-error-when-swiching-youtube-accounts">link</a></li>
</ul>

<p>What's even more weird is that if I try switching between the Youtube accounts several times, it <strong>sometimes</strong> makes request for the correct account, so the code is correct, but still doesn't offer the desired result.</p>

<p>So how can I make proper authorized requests based on a certain Youtube account?</p>