Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
Can't use an API due to CORS in Reacr fetch

I'm trying to make a get request in React using javascript fetch, but i can't solve the problem of cors.

The doc of the Api that i'm trying to use is here: "https://docs.abuseipdb.com/#check-endpoint".

Below the code:

export async function getAbuseipInfo(ip, apiKey) {

    const baseUrl = "https://api.abuseipdb.com/api/v2/check?ipAddress=";

        console.log(baseUrl + ip);
        console.log(apiKey);

        await fetch(baseUrl + ip, {
            method: 'GET',
            mode: 'no-cors', //with this in no-cors mode the value Key is not sended and return 401.
            headers: {
                'Key': apiKey,
                'Accept': 'application/json',
                'Access-Control-Allow-Methods': '*', //test to allow all but not working.
                'Access-Control-Allow-Headers': '*',
                'Access-Control-Allow-Origin': '*'
            },
        })
            .then(response => response.json())
            .then(data => {
                console.log('Success:', data);
            })
            .catch((error) => {
                console.error('Error:', error);
            });
}

I tried without mode: 'no-corse' but i get the cors block.

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!