title: Youtube live streaming API - list watching users
body: <p>I wanted to make my own chatbot for livestreaming and I'm struggling with the loyalty system. I wanted to reward users for watching the stream. But I'm unable to list all users that are watching the livestream using data/livestream API. I can list moderators, messages or concurrent viewers (just a number). But I would need list of names/ids/some identification so I can assign rewards. Is it possible to do with youtube API?</p>
  
  <p>I saw some working loyalty system bots (like FussBot) but they were on YouTube Gaming, this is regular livestream. Is it possible to do it on Youtube? I wasn't able to find it in google documentation.</p>
  
  <p>Code below is working snippet how to get credentials and service to run some queries.</p>
  
  <pre><code>UserCredential credential;
  using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
  {
      credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
      GoogleClientSecrets.Load(stream).Secrets,
      new[] { YouTubeService.Scope.YoutubeReadonly },
      "user",
      CancellationToken.None,
      new FileDataStore(this.GetType().ToString()));
  }
  
  var youtubeService = new YouTubeService(new BaseClientService.Initializer()
  {
      HttpClientInitializer = credential,
      ApplicationName = "bot name"
  });
  </code></pre>