title: Get List of Youtube channels subscribe by current user in android?
body: <p>Hello I want to get list of channels subscribe by current user in android. </p>
  
  <p>Steps I follow:</p>
  
  <p>1) <a href="https://developers.google.com/youtube/v3/docs/subscriptions/list" rel="nofollow">https://developers.google.com/youtube/v3/docs/subscriptions/list</a></p>
  
  <p>By read the description, I created <strong>API key</strong> for android and <strong>oauth</strong> key in google developer console and tired to implement following request</p>
  
  <p><a href="https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&amp;mine=true&amp;key=%7BYOUR_API_KEY%7D" rel="nofollow">GET https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&amp;mine=true&amp;key={YOUR_API_KEY}</a>. you can see I have set only <code>part = snippet</code> and <code>mine = true</code>. </p>
  
  <p>For authentication I followed <a href="https://developer.android.com/training/id-auth/authenticate.html" rel="nofollow">https://developer.android.com/training/id-auth/authenticate.html</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>AccountManager am = AccountManager.get(this);
  Bundle options = new Bundle();
  
  am.getAuthToken(
      myAccount_,                     // Account retrieved using getAccountsByType()
      "Manage your tasks",            // Auth scope
      options,                        // Authenticator-specific options
      this,                           // Your activity
      new OnTokenAcquired(),          // Callback called when a token is successfully acquired
      new Handler(new OnError()));    // Callback called if an error occurs
  </code></pre>
  
  <p>After adding proper permission I can get my account in myAccount_</p>
  
  <p>on call backbaack of <strong>TokenAcquire</strong></p>
  
  <pre><code>private class OnTokenAcquired implements AccountManagerCallback&lt;Bundle&gt; {
      @Override
      public void run(AccountManagerFuture&lt;Bundle&gt; result) {
          // Get the result of the operation from the AccountManagerFuture.
          Bundle bundle = result.getResult();
  
          // The token is a named value in the bundle. The name of the value
          // is stored in the constant AccountManager.KEY_AUTHTOKEN.
          token = bundle.getString(AccountManager.KEY_AUTHTOKEN);
          ...
      }
  }
  </code></pre>
  
  <p><strong>I am not getting the token value</strong>. </p>
  
  <p>Please guide me. <strong>Is there some alternative approach</strong> Or if have to update/modify something?</p>
  
  <p>My permission in xml are</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCOUNT_MANAGER" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.USE_CREDENTIALS" /&gt;
  </code></pre>
  
  <p>I am getting error at this line <code>token = bundle.getString(AccountManager.KEY_AUTHTOKEN);</code> in my catch of exception handling.</p>
  
  <blockquote>
    <p>android.accounts.AuthenticatorException.
    Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference</p>
  </blockquote>
  
  <p>I am using android 6.0 and it require run time permission.</p>