I am trying to create a web app that displays TikTok videos in it. In most computers, that works fine, but for one of the clients, the video is loaded but can not be played. I get the following errors in the console: (sorry about the bad image it is the best I got)
Notice that the URL returned 403
is v16-web.tiktok.com
while I send the get request to tiktok.com.
This is the relevant code:
function embed_post(link) {
fetch("https://www.tiktok.com/oembed?url=" + link)
.then(response => response.json())
.then(data => {
$("#post_view").html(data["html"])
})
}
Where "link" is the link to the video in tiktok that looks like www.tiktok.com/{user secUid}/{video id}
Does anyone know how can I fix it? Thanks for the help.
403 means the server side judged the authority of the media requesting and failed. Cause the TikTok video load in a iframe, a possible reason is that the browser in those clients forbidden carrying cookies when requesting the media in a iframe (like in a Incognito mode).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.