even though there are a few post/questions on CORS issues with Flutter I'm still unable to fix it with the solutions available, which mostly involving fixing it on the server-side. In my case, I don't have access to the server/API. Additionally, it's has been very hard to ask the third party to change their services, since while testing with other frameworks/languages such as Python and VBA there were no issues getting data from the API as well as with INSOMNIA testing.
So, my thinking is that for some reason flutter is triggering CORS, is there to "disable" it, on the request?
The error I'm getting is:
Access to XMLHttpRequest at 'https://ift.tt/2QZN5lY' from origin 'http://localhost:56659' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
If I disable CORS locally it works, but obviously, it fails when deployed.
Here's how I'm currently doing my request in Flutter.
else {
final response = await http.post(Uri.parse(API),
body: json.encode({
"key": Key,
"user": User,
"pass": Pass,
}),
headers: <String, String>{'Content-type': 'application/json'});
Thanks,
Aucun commentaire:
Enregistrer un commentaire