我尝试使用 youtube java api 通过我的 java 桌面应用程序连接到我的 youtube 帐户,我已遵循本指南:https ://developers.google.com/youtube/2.0/developers_guide_java?hl=pt-BR#ClientLogin_for_Installed_Applications看起来很容易,但我得到一个错误,这是我的代码:
String developer_key = "key123456789"; // Registered developer key
String application_name = "app"; // Registered application name
String user_account = "user@gmail.com"; // Server's Youtube account
String user_password = "mypass"; // Server's Youtube password
YouTubeService service = new YouTubeService(application_name, developer_key);
try {
service.setUserCredentials(user_account, user_password);
} catch (AuthenticationException e) {
System.out.println("Error: " + e);
}
但我不断收到此错误:
com.google.gdata.util.AuthenticationException: Error connecting with login URI
错误发生在 setUserCredentials 函数中,有人知道我缺少什么吗?