Requirement . I am trying to upload a video to my Youtube channel through the Youtube data API for Java. The request is sent from a war file hosted on the tomcat container. My application is not for external users, and I only use it to download my own videos. Using the api documentation and sample YouTube code snippets, I was able to successfully post the video on youtube.
Problem: The problem is that whenever I try to run the code, I get a request for
Please open the following address in your browser: https://accounts.google.com/o/oauth2/auth?client_id= & redirect_uri = http: // localhost: 8080 / Callback & response_type = code & scope = https: //www.googleapis. com / auth / youtube.upload
Since I run this code on a remote server, I cannot always open this URL in a browser. Since I registered my web application with Google Console and got a couple of client identifiers and secret files and a JSON file, so Youtube should allow me to post videos by default, at least on my channel, right?
I used the Auth.java file (provided in the youtube java code samples) and the following code is here where this happens.
return new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user@.com");
LocalServerReceiver localReceiver = new LocalServerReceiver.Builder().setPort(8080).build();
Please help here, as it is really a very long time for my development.