Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Authentication Error when trying to retrieve Youtube Chanel Information

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

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!