0

Here is my curl code which one i am trying over swagger is working.

    curl -X 'GET' \
    'http://178.154.200.180:8080/api/v1/user/brands' \
    -H 'accept: application/json' \
    -H 'Cookie: wba-session-id=13afbb83-a4e1-4fd5-b8bb-b35187164188'

The same curl code i converted to react fatch but it is saying un authorized.

        useEffect(() => {
            let headers = {
                'accept': 'application/json',
                'Cookie': '13afbb83-a4e1-4fd5-b8bb-b35187164188'
            }
            fetch('http://178.154.200.180:8080/api/v1/user/brands', { headers: headers })
              .then(res => res.json())
              .then(res => { 
                alert(res)
             })
        }, [])

http://178.154.200.180:8080/api/v1/user/brands

url works over browser

Please take a look where i am doing wrong.

0 Answers0