After developing a NodeJS application for uploading videos to a YouTube channel via the command line interface, I encountered a challenge. Every upload redirects me to a specific redirect_uri as per Google Docs requirements.
To bypass user authorization/sign-in, I included 'prompt: none' during authentication with the YouTube API. However, I am now seeking a way to completely avoid visiting any URI and have the process just run within the command line itself.
Do you have any suggestions?
let oauth = Youtube.authenticate({
type: 'oauth',
client_id: CREDENTIALS.web.client_id,
client_secret: CREDENTIALS.web.client_secret,
redirect_url: CREDENTIALS.web.redirect_uris[0]
});
opn(oauth.generateAuthUrl({
access_type: 'offline',
scope: ['https://www.googleapis.com/auth/youtube.upload'],
prompt: 'none'
}));
The original redirect uri is specified when creating the app in the Google Developer's console. You then download the JSON file, incorporate it into your working directory, and extract the Client_id, client_secret, and redirect_uri from the JSON to authenticate YouTube using oauth2.0.
Disabling the redirect_uri results in an error stating "invalid request - redirect_uri required." Is there a potential workaround, such as redirecting only once instead of after each upload made through node file.js on the terminal?