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

1.1K
Views
Error: No se ha establecido ningún acceso, token de actualización o clave de API. Google YouTube API V3

Voy a obtener mi lista de suscripción con la ayuda de la API de YouTube. Escribí este fragmento de código.

 const { google } = require('googleapis'); const oauth2 = google.oauth2('v2'); const express = require('express') const app = express() const port = 3000 const oauth2Client = new google.auth.OAuth2( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxx", "http://localhost:3000/auth/google/callback" ); google.options({ auth: oauth2Client }); // generate a url that asks permissions for Blogger and Google Calendar scopes const scopes = [ 'https://www.googleapis.com/auth/youtube', 'https://www.googleapis.com/auth/youtube.channel-memberships.creator' ]; const url = oauth2Client.generateAuthUrl({ // 'online' (default) or 'offline' (gets refresh_token) access_type: 'offline', // If you only need one scope you can pass it as a string scope: scopes }); app.get('/',(req,res,next)=>{ res.send(url); }) let tok = ""; app.get('/auth/google/callback',(req,res,next)=>{ res.send('Susses Authrations'); console.log("Code authrations : "+req.query.code); const {tokens} = oauth2Client.getToken(req.query.code) oauth2Client.setCredentials(tokens); oauth2Client.on('tokens', (tokens) => { if (tokens.refresh_token) { // store the refresh_token in my database! console.log("refresh_token : "+ tokens.refresh_token); tok = tokens.access_token; } console.log("Assess Token : "+ tokens.access_token); }); }) app.get('/youtube',(req,res,next)=>{ const youtube = google.youtube('v3',{ 'access_token':oauth2Client.credentials.access_token, 'refresh_token':oauth2Client.credentials.refresh_token, 'api_key':oauth2Client.credentials.api_key }); youtube.channels.list({ "part": [ "snippet,contentDetails,statistics" ], "id": [ "UC_x5XG1OV2P6uZZ5FSM9Ttw" ] }).then(e=>{ console.log(e.request) }) }) app.listen(port,()=>{ console.log("Hello World") });

Pero desafortunadamente me encuentro con un error (Error: No se ha configurado el acceso, el token de actualización o la clave de API) que aparentemente no reconoce mi token de actualización. Soy un novato y gracias por guiarme. También uso la identificación de clinet y el secreto de clinet. También construí una consola dentro de Google y activé las bibliotecas relacionadas con YouTube.

over 4 years ago · Santiago Trujillo
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!