Java:如何获取应用程序的 youtube 访问/刷新 token ?

标签 java youtube google-api

我有带有凭据的谷歌应用程序:
应用程序名称、API key 、客户端 ID、客户端电子邮件、客户端密码 ...

是否可以在没有用户授权的情况下访问 youtube api。
例如,使用用户身份验证,我可以获得刷新 token 并获得访问 token ,如下所示:

 TokenResponse response = new RefreshTokenRequest( GOOGLE_HTTP_TRANSPORT, GOOGLE_JSON_FACTORY, new GenericUrl( "https://www.googleapis.com/oauth2/v3/token" ), channelYoutubeAccess.getRefreshToken() ).setClientAuthentication( new ClientParametersAuthentication( getGoogleClientId(), getGoogleClientSecret() ) ).execute();
    if( response != null ) {
      accessToken = response.getAccessToken();
    }

你可以帮帮我吗。谢谢你。

最佳答案

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=snippet&id=QK8mJJJvaes&_h=4&

final YouTube.Videos.List listRq = youtube.videos().list("id, status").setId(id).setKey(CLIENT_KEY);
        VideoListResponse searchResponse = listRq.execute();

关于Java:如何获取应用程序的 youtube 访问/刷新 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32306396/

相关文章:

java - 如何调整 JOptionPane.showConfirmDialog 的大小

java - Spring JPA 和 persistence.xml

javascript - YouTube 视频无法在移动设备上加载(嵌入灯箱中)

java - 从 lambda 表达式中更新 AtomicBoolean

javascript - 当应用程序在后台运行时,响应 native 电源按钮长按监听器

angular - Youtube订阅按钮在Angular项目中不起作用

java - YouTube视频仅在屏幕上播放音频,而在WebView Android中旋转

.net - GoogleWebAuthorizationBroker 不会自动从刷新 token 返回新的访问 token

google-api - 谷歌日历api CalendarList列表返回空元素

php - 支付 API 权限被拒绝