Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda