CORS issue on localhost

CORS issue on localhost

I have CORS error with this code:
Access to fetch at 'http://sandbox.tikapi.io/public/search/videos?country=vn&session_id=0&query=sneaker' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

const api = TikAPI('mykey');

api.set({
$sandbox: true
});
const fetchData = async () => {
try{
let response = await api.public.search({
category: "videos",
query: "sneaker",
country: "vn"
});

console.log("response", response?.json);

while(response){

let nextCursor = response?.json?.nextCursor;
console.log("Getting next items ", nextCursor);

response = await Promise.resolve(
response?.nextItems()
);
}
}
catch(err){
console.log(err?.statusCode, err?.message, err?.json)
}
}