title: Youtube API v3 : using service account to list videos
body: <p>I'm trying to use Google Service Account to list videos from YouTube Data API v3. I activated YouTube API, created Account Service, but whenever I try to list videos from my channel, it says 0 videos even if I do have uploaded videos.</p>
  
  <p>I ran samples from their docs but it seems like my credentials list videos from my service account directly and not my real YouTube account.</p>
  
  <pre><code>List&lt;String&gt; scopes = Lists.newArrayList("https://www.googleapis.com/auth/youtube");
  
  JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
  HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
  GoogleCredential credential = new GoogleCredential.Builder()
              .setTransport(httpTransport)
              .setJsonFactory(JSON_FACTORY)
              .setServiceAccountId("youtube-****serviceaccount.com")
              .setServiceAccountScopes(scopes)               
              .setServiceAccountPrivateKeyFromP12File(new File("C:\\tmp\\youtube.p12"))
              .build();
  
  youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, credential).setApplicationName(
              "youtube-cmdline-uploadvideo-sample").build();
  YouTube.Channels.List channelRequest = youtube.channels().list("contentDetails");
          channelRequest.setMine(true);
          ChannelListResponse channelResult = channelRequest.execute();
  
      List&lt;Channel&gt; channelsList = channelResult.getItems();
  
  
      String uploadPlaylistId = channelsList.get(0).getContentDetails().getRelatedPlaylists().getUploads();
  </code></pre>
  
  <p><code>uploadPlaylistId</code> should be here my channel ID, but I do not know what it is, all I know it's that this is an empty channel. (If i check here using my real ID channel, I can list my uploads, it seems my service account does not refer correctly on my YouTube account...)</p>