using tus-js-client.js with node.js 401 error

98 views Asked by At

using node.js with tus client to upload video file im trying to get upload link but keep getting 401 !! Request failed with status code 401

async function createVimeoUploadLink() {
      console.log("enterig createVimeoUploadLink",accessToken);
      try {
        const response = await axios.post(
          "https://api.vimeo.com/me/videos",
          {
          headers: {
            Authorization: `Bearer ${accessToken}`,
            'Content-Type': 'application/json',
            
          },
          body: {
            upload: {
                "approach": "tus",
                "size": "17839845"
            }
        },
      }
        );
        const uploadLink = response.data.upload.upload_link;
      console.log('uploadLink', uploadLink)
        return uploadLink;
      } catch (error) {
        throw new Error("Failed to create Vimeo upload link: " + error.message);
      }
    }
0

There are 0 answers