YouTube에 특정 YouTube 계정으로 비디오를 업로드해야합니다. 그래서 내가 자바 구글 lib를 사용하고 인증해야합니다. 코드는 다음과 같습니다서버의 Google 인증
Credential credential = new GoogleCredential.Builder()
.setTransport(new ApacheHttpTransport())
.setJsonFactory(new JacksonFactory())
.setServiceAccountId("[email protected]")
.setClientSecrets("[email protected]", "xx")
.setServiceAccountPrivateKeyFromP12File(new File("xx.p12"))
.setServiceAccountScopes(scopes)
.setServiceAccountUser("[email protected]")
.build();
youtube = new YouTube.Builder(credential.getTransport(), credential.getJsonFactory(), credential).setApplicationName(
"tellews-app").build();
Video returnedVideo = videoInsert.execute();
YouTube.Videos.Insert videoInsert = youtube.videos()
.insert("snippet,statistics,status", videoObjectDefiningMetadata, mediaContent);
Video returnedVideo = videoInsert.execute();
그리고 점점 오류 :
IOException: 401 Unauthorized { "error" : "unauthorized_client", "error_description" : "Client is unauthorized to retrieve access tokens using this method." }
어쩌면 누군가가 내가