Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Authentication Error when trying to retrieve Youtube Chanel Information

$
0
0

I am trying authenticate the user and then retrieve youtube channel list.

Below is the function to authenticate:

function authenticate() {  showNewLoader('show');  return gapi.auth2.getAuthInstance()  .signIn({scope: "https://www.googleapis.com/auth/youtube.readonly"})  .then(function(response) {      console.log( response);    youtubeAuthResponse['token_details'] = response.tc;     youtubeAuthResponse['google_email'] = '';    youtubeAuthResponse['google_id'] = '';    showNewLoader('hide');  },  function(err) { console.error("Error signing in", err); showNewLoader('hide');});}

Loading client:

function loadClient() {  showNewLoader('show');  gapi.client.setApiKey("XXXXXX");  return gapi.client.load("https://www.googleapis.com/discovery/v1/apis/youtube/v3/rest")  .then(function() { execute();},    function(err) { console.error("Error loading GAPI client for API", err);showNewLoader('hide');});}/*Make sure the client is loaded and sign-in is complete before calling this method.*/function execute() {  return gapi.client.youtube.channels.list({"part": ["snippet","statistics"    ],"mine": true  })  .then(function(response) {    /*Handle the results here (response.result has the parsed body).*/    youtubeChannelResponse = response.result;    storeYoutubeData();  },  function(err) { console.error("Execute error", err); showNewLoader('hide') }).then(function(){  });}

User logs in successfully but I am unable to get the channel info:

enter image description here

Any assistance on this issue is greatly appreciated. @DalmTo


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>