title: facebook api get live comment
body: <p>as facebook mentioned <a href="https://developers.facebook.com/docs/graph-api/server-sent-events/endpoints/live-comments" rel="nofollow noreferrer">here</a> for get live comment </p>
  
  <p>and i do like what they said </p>
  
  <pre><code>var source = new EventSource("https://streaming-graph.facebook.com/2025853151054872/live_comments?access_token=MY TOKEN HERE&amp;fields=from{name,id},message");
  source.onmessage = function(event) {
  console.log(event);
    // Do something with event.message for example
  };
  </code></pre>
  
  <p>this will give me 401 error and as they mentioned <a href="https://developers.facebook.com/docs/graph-api/server-sent-events/endpoints/live-comments" rel="nofollow noreferrer">here</a> at the end of page its mean </p>
  
  <blockquote>
    <p>Unauthorized</p>
    
    <p>Make sure your app has the right permissions and that the access token is valid.</p>
  </blockquote>
  
  <p>so i checked my access token <a href="https://developers.facebook.com/tools/debug/accesstoken/" rel="nofollow noreferrer">here</a></p>
  
  <p>and its give me this result </p>
  
  <pre><code> Metadata   {"sso":"chrome_custom_tab","auth_type":"rerequest"}
   Valid  True
   Data Access Expires    1560876206 (in about 3 months)
   Origin Mobile Web Faceweb
   Scopes email, publish_video, manage_pages, pages_show_list, publish_pages, public_profile
  </code></pre>
  
  <p>i don't know why there is error and every thing its right</p>
  
  <p>also i test same url with android library <a href="https://github.com/tylerjroach/eventsource-android" rel="nofollow noreferrer">library</a>
  and same its give me error </p>