问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/63187719/vimeo-api-cant-upload-video-no-user-credentials-were-provided-8003