0

I am working on Nuxt 3 with useFetch hook to call API. When I call the 3rd party API post https://apitest.bankfeeds.com.au/v1/customer/data using useFetch hook, it returns the CORS error

CORS Missing Allow Origin

I have the ssr: false in my nuxt.config.ts file

check error here

I have tried to set cors on nuxt config file but not working and returns the same error.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • Does this answer your question? [No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API](https://stackoverflow.com/questions/43871637/no-access-control-allow-origin-header-is-present-on-the-requested-resource-whe) – jub0bs Sep 01 '23 at 12:54
  • looks like makes sense but I want this on nuxt 3 so how can I configure the origin proxy policy to call 3rd party API with front end only? Please help me with this – Kishan Bhensadadiya Sep 01 '23 at 13:10

1 Answers1

0

It's probably giving you a CORS error because you are fetching the API through the browser and not trough the backend.

Most third party API's deny cross-origin requests.

Try fetching the API from postman, if it works just put the fetch call in the server-side backend.

chillin.killer
  • 79
  • 1
  • 11