IBM Watson Conversation API: “Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response”

前端 未结 2 1950
长情又很酷
长情又很酷 2021-01-26 20:23

I created a React-Native app that connected to the Watson REST APIs. Using the fetch library that is part of the ReactNative, everything was working well for getting the Workspa

2条回答
  •  情书的邮戳
    2021-01-26 21:29

    Remove whatever client-side code is setting the Access-Control-Allow-Headers request header.

    The header is a response header CORS-enabled servers send. You don’t set it from the client side.

    Based on the error messages cited in the question, it sound like the server may already be correctly configured to send the right Access-Control-* headers. (Otherwise you’d instead be getting an error saying there’s no Access-Control-Allow-Origin in the response.)

    The only error identifiable from the information in the question at this point is just that problem of the request including an Access-Control-Allow-Headers request header that shouldn’t be there.

提交回复
热议问题