Can someone help me find a working code that goes through authorization and uploads a video?
Code below goes I'm able to get the access_token but when I paste it on the command line, it returns a "cb is not a function" error
const fs = require('fs');const { google } = require('googleapis');const readline = require('readline');const OAuth2 = google.auth.OAuth2;// If modifying these scopes, delete your previously saved credentials// at ~/.credentials/upload_app_session.jsonconst SCOPES = ['https://www.googleapis.com/auth/youtube.upload','https://www.googleapis.com/auth/youtube.readonly'];const TOKEN_DIR ='./';const TOKEN_PATH = TOKEN_DIR +'upload_app_session.json';const authorize = (credentials, cb) => {const clientSecret = credentials.web.client_secret;const clientId = credentials.web.client_id;const redirectUrl = credentials.web.redirect_uris[0];const oauth2Client = new OAuth2(clientId, clientSecret, redirectUrl);fs.readFile(TOKEN_PATH, (error, token) => { if (error) { getNewToken(oauth2Client, cb); } else { oauth2Client.credentials = JSON.parse(token); cb(null, oauth2Client); }});};const getNewToken = (oauth2Client, cb) => {const authUrl = oauth2Client.generateAuthUrl({ access_type: 'offline', scope: SCOPES}); console.log('Authorize this app by visiting this url: ', authUrl); const rl = readline.createInterface({ input: process.stdin, output: process.stdout}); rl.question('Enter the code from that page here: ', code => { rl.close(); oauth2Client.getToken(code, (error, token) => { if (error) { cb(new Error('Error while trying to retrieve access token', error)); } else { oauth2Client.credentials = token; storeToken(token); cb(null, oauth2Client); } });});};const storeToken = token => {try { fs.mkdirSync(TOKEN_DIR);} catch (error) { if (error.code != 'EEXIST') { throw error; } } fs.writeFile(TOKEN_PATH, JSON.stringify(token), error => { if (error) throw error; console.log('Token stored to '+ TOKEN_PATH); }); };module.exports = { authorize };Tried the quickstart example from google developers but it didn't work either.