本文介绍了Vimeo API:无法上传视频-“未提供用户凭据".(8003)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将视频从我的ReactJS应用程序上传到Vimeo,但是我收到了未提供用户凭证".错误(8003).

我从Vimeo API遵循了该指南:

如您所见,我确实具有上传权限.

我在做什么错了?

解决方案

如果您共享的访问令牌是您实际使用的令牌,则该令牌仅具有 public 范围,对此我进行了验证具有该令牌的/oauth/verify 终结点请求(文档在这里).

如果您张贴在帖子中的令牌是虚拟"邮件,令牌,以便在此处发布,然后使用您的真实令牌向该端点发出请求,并查看响应-如果它是未经身份验证的(client_credentials)令牌,或者它是没有范围 public private edit upload 无法用于上传.

I'm trying to upload a video from my ReactJS application to Vimeo but I'm getting a "No user credentials were provided." error (8003).

I followed this guide from the Vimeo API: https://developer.vimeo.com/api/upload/videos#form-approach

My code (for the first step of uploading a video):

const accessToken = "74a218e620507395c78219ab9421639c";

const size = form.file.size; // size of video in bytes

axios
  .post("https://api.vimeo.com/me/videos", {
    headers: {
      Accept: "application/vnd.vimeo.*+json;version=3.4",
      "Content-Type": "application/json",
      Authorization: "bearer " + accessToken,
    },
    upload: {
      approach: "post",
      size: size,
      redirect_url: "http://localhost:8083/success1",
    },
  })
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error);
    console.log(error.response);
  });

The response:

As you see I do have upload access.

What am I doing wrong?

解决方案

If the access token you shared is what you're actually using, the token only has public scope, which I verified by making a request with that token to /oauth/verify endpoint (docs here).

If the token you put in your post was a "dummy" token for the purposes of posting here, then make a request to that endpoint with your real token and take a look at the response -- if it's an unauthenticated (client_credentials) token, or if it's an authenticated token that doesn't have the scopes public private edit upload it cannot be used for upload.

这篇关于Vimeo API:无法上传视频-“未提供用户凭据".(8003)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 04:12
查看更多