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:
Any assistance on this issue is greatly appreciated. @DalmTo
