# Calling flask api from react spa returns 403 /url forbidden-

**URL:** <https://community.auth0.com/t/calling-flask-api-from-react-spa-returns-403-url-forbidden/42540>\
**Category:** Get Help\
**Tags:** auth0-spa-js, reactjs, api\
**Created:** [May 7, 2020, 6:35am UTC](https://community.auth0.com/t/calling-flask-api-from-react-spa-returns-403-url-forbidden/42540 "2020-05-07T06:35:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdbeng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sdbeng/32/18712_2.png) [@sdbeng](https://community.auth0.com/u/sdbeng)\
**Post date:** [May 7, 2020, 6:35am UTC](https://community.auth0.com/t/calling-flask-api-from-react-spa-returns-403-url-forbidden/42540/1 "2020-05-07T06:35:13Z")

</div>

Hey there,  
I’m testing a logged in user make an api call to delete a product item against a flask api. I see the console and network tab return Delete 403 forbidden even tho I’m passing the right product id to the url in the fetch call. The login works fine and i get the needed token bearer to access the resource. I’ve also checked the [jwt.io](http://jwt.io) and it has the proper scopes, delete:products in this case.  
I tried to wrap fetch call in a useEffect hook but couldn’t make it work, something about not being a custom hook. Until can figure it out the issue, I decided to use plain fetch function.  
What’s missing on this call?  
Thanks in advance.

const ProductPreview = ({id, title, release\_date, onRemove}) =\> {

const {getTokenSilently} = useAuth0()

const handleRemoveProduct = async () =\> {  
const token = await getTokenSilently()  
console.log('token log: ', token)  
console.log(' **id log**', id)

```
const confirm = window.confirm(`Are you sure you want to delete ${title}?`)

if (confirm){
    fetch(`https://mysite.herokuapp.com/products/${id}`, {
        method:'DELETE',
        headers:{
            Authorization: `Bearer ${token}`,
            'Content-Type': 'application/json;charset=UTF-8'                  
        }
    })
    .then(() => {
        onRemove(id)
    })
    .catch(error => console.error('error============:', error));

```

}

---

<div class="post-metadata">

**Author:** ![sdbeng](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sdbeng/32/18712_2.png) [@sdbeng](https://community.auth0.com/u/sdbeng)\
**Post date:** [May 7, 2020, 4:18pm UTC](https://community.auth0.com/t/calling-flask-api-from-react-spa-returns-403-url-forbidden/42540/2 "2020-05-07T16:18:44Z")

</div>

Never mind I’ve solved the issue. Yet, still working to refactor the fetch call into a useeffect hook. 👍
