'Can't post videos to Tiktok using the Web Video Kit API

I am trying to upload a video to Tiktok using this endpoint:

https://open-api.tiktok.com/share/video/upload/

Following the official docs: https://developers.tiktok.com/doc/web-video-kit-with-web

(After successfully authenticating with Tiktok and getting an access token using the Login Kit API). I am getting a response that suggests success (with error_code=0 and a non-empty share_id), however nothing gets uploaded and my Tiktok app's callback url does not seem to be getting triggered with any status update.

I've tried hitting the API from several different environments - a Node.js runtime (using Axios), a cURL request from 2 different machines (all getting the result described above) and also from my frontend code using Fetch (this one got me a CORS error). Code snippets below.

Will appreciate any help since I'm out of ideas as for what to try next. Also if there are any other docs or online resources besides the one I linked to that might be helpful, any links to such will be great.

Note: I made sure my test videos are satisfying the constraints mentioned in the docs.

My Node.js code:

    const url = `https://open-api.tiktok.com/share/video/upload?open_id=${openId}&access_token=${accessToken}`;
const data = new FormData();
data.append('video', fs.createReadStream(path.join(os.tmpdir(), 'test.mp4')));
await axios.post(url, data, {
  headers: data.getHeaders()
});

cURL request:

curl --location --request POST 'https://open-api.tiktok.com/share/video/upload?open_id=<open_id>&access_token=<access_token>' --form 'video=@"/path/to/video.mp4"'

Response payload (for both cURL and Node.JS requests):

{"data":{"err_code":0,"error_code":0,"share_id":"video.7031619168818448385.CGdXCmaC"},"extra":{"error_detail":"","logid":"2021111721133201024513311411A971D3"}}

Frontend code (Fetch, getting a 307 response with the same Tiktok URL (/share/video/upload...) in the Location header - resulting in CORS error):

const formData = new FormData();
formData.append('video', selectedFile);

const requestOptions = {
  method: 'POST',
  body: formData,
  redirect: 'follow'
};

const URL = `https://open-api.tiktok.com/share/video/upload?access_token=${accessToken}&open_id=${openId}`;

fetch(URL, requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log('error', error));


Solution 1:[1]

You need to download tiktok app, than publish video uploaded by your api.

The user who triggered the video upload should receive a notification on TikTok App after the video uploaded successfully and the user can publish the video on the app.

Solution 2:[2]

In case you get "Something went wrong, try again later". It is probably your region issue. You will need to try a vpn and try again.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stepan Hovda
Solution 2