Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

306
Vistas
Access to fetch at 'https://open-api.trovo.live/openplatform/channels/id' from origin 'http://localhost:3000

I am having a problem with fetching profile data from Trovo API.

Access to fetch at 'https://open-api.trovo.live/openplatform/channels/id' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

In the documentation of the API says:

If you are making API calls from the client side, you may come across CORS issues. Your domain needs to be whitelisted in Trovo in order to do CORS calls.

In addition, please add origin in the header when you are making cross-site calls.

I am getting this error on production too, where I am using my registered domain.

const fetchProfile = async () => {
    const ress = await fetch(
      "https://open-api.trovo.live/openplatform/channels/id",
      {
        method: "POST",
        headers: {
          Accept: "application/json",
          "Client-ID": `${process.env.TROVO_CLIENT_ID}`,
          "Content-Type": "application/x-www-form-urlencoded",
        },
        body: '{"username":"test"}',
      }
    ).then((res) => res.json());
about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

You can make a proxy call.
On client side u can call :3000/trovo or something like this
And on server side make the call to the server

cli -> server -> trovo -> server -> cli

u encumber load on server, but u avoid cors

about 4 years ago · Santiago Gelvez Denunciar

0

Your browser is stopping your local site calling any resource not on the same domain. In your package.json add the line:

proxy: "https://open-api.trovo.live";

and change your fetch call to be:

const ress = await fetch(
      "/openplatform/channels/id", ...

However, this will only work in dev and still may not work. I have not used Trovo so can't say exactly but in Sanity I have to go into the project settings and add all my domains in the CORS/Whitelist section which is what this is saying:

If you are making API calls from the client side, you may come across CORS issues. Your domain needs to be whitelisted in Trovo in order to do CORS calls.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda