<p>Your URL appears to be incorrect:</p>
<pre><code>https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest
</code></pre>

CC BY-SA 4.0
2023-02-12T08:42:39.000Z
2023-02-12T08:42:39.000Z
Marek Mahut - StakeNuts
<p>I'm trying to get info about the latest block in my React Node JS app using Blockfrost and I'm running into an error:</p>
<pre><code>GET https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest 403 (Forbidden)
</code></pre>
<p>Why is this happening? Any potential solutions are much appreciated!</p>
<p>Here's my code:</p>
<pre><code>useEffect(() =&gt; {
fetch(
  'https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest',
  {
    contentType: &quot;application/json&quot;,
    headers: {
      project_id: PROJECT_ID
    },
    method: 'GET'
  }
)
  .then(response =&gt; {
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`)
    }
    return response.json()
  })
  .then(data =&gt; {
    console.log(data)
  })
  .catch(error =&gt; {
    console.error(error)
  })
</code></pre>
<p>}, [])</p>

<blockfrost><react><reactjs>
Blockfrost API 403 Error in React Node JS app
# Blockfrost API 403 Error in React Node JS app

(Asked by: username_0 on 2023-02-12)

I'm trying to get info about the latest block in my React Node JS app using Blockfrost and I'm running into an error:
GET https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest 403 (Forbidden)

Why is this happening? Any potential solutions are much appreciated!
Here's my code:
useEffect(() => {
fetch(
  'https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest',
  {
    contentType: "application/json",
    headers: {
      project_id: PROJECT_ID
    },
    method: 'GET'
  }
)
  .then(response => {
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`)
    }
    return response.json()
  })
  .then(data => {
    console.log(data)
  })
  .catch(error => {
    console.error(error)
  })

}, [])

**Tags:** blockfrost, react, reactjs

---

## 1 answers

### Answer by username_1 on 2023-02-12. Score: 1

Your URL appears to be incorrect:
https://cors-anywhere.herokuapp.com/https://cardano-mainnet.blockfrost.io/api/blocks/latest


---

