【问题标题】:Android Google Drive API v2 downloadUrl with access token stopped working带有访问令牌的 Android Google Drive API v2 downloadUrl 停止工作
【发布时间】:2020-02-17 04:03:01
【问题描述】:

我的应用曾经使用 v2 的 downloadUrl() + access_token 播放 Google Drive 视频

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(videoItem.downloadUrl() + "&access_token=" + mAccessToken), "video/avi");
startActivity(intent);

但是,它有一天会无缘无故停止工作。

我尝试过使用 v3 的 webContent()

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(videoItem.webContent()));
startActivity(intent);

但这样他们需要在观看视频的设备上登录 Google。

有谁知道为什么 v2 的 downloadUrl() + access_token 停止工作? 另外为什么以下不起作用?因为我想在 Google Drive 应用程序中的第三方播放器中播放我的视频。

intent.setDataAndType(Uri.parse(videoItem.webContent()), "video/avi");

提前谢谢你。

【问题讨论】:

  • 请定义停止工作。访问令牌过期后你刷新了吗?
  • 我不能再用这个链接播放视频 "videoItem.downloadUrl() + "&access_token=" + mAccessToken
  • 每次都使用新的访问令牌

标签: android google-api google-drive-api google-oauth


【解决方案1】:

是的,downloadUrl() + access_token 于 2020 年 1 月 1 日停止工作,因为 recent changes for the authorization for Google Drive API

遵循文档中描述的新程序,基本上

您需要迁移您的请求以使用 HTTP 进行身份验证 标题

【讨论】:

  • 你能举一个V3的例子吗
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-20
  • 2023-04-10
  • 1970-01-01
相关资源
最近更新 更多