简体   繁体   中英

I am getting XMLHttpRequest Error when I am trying to connect to parse server from flutter web app

I am getting XMLHttpRequest error whenever I am trying to connect to parse server through the flutter web app. I found it to be CORS issue but don't know how to solve this. I did see the documentation of parse_server_sdk_flutter where it says for web support, "Due to Cross-origin resource sharing (CORS) restrictions, this requires adding X-Parse-Installation-Id as an allowed header to parse-server. When running via express, set ParseServerOptions allowHeaders: ['X-Parse-Installation-Id']" I have been looking everywhere to know where do I need to add this and how do I add this. Honestly, I don't know how to add this and which part of code to add this. I am stuck at this since couple of days. My whole project is based on this parse-server backend and I really don't know how to solve this issue. Please help!

Use ParseDioClient :

https://pub.dev/packages/parse_server_sdk_flutter

await Parse().initialize(
  clientCreator: ({
    bool? sendSessionId,
    SecurityContext? securityContext
  }) => ParseDioClient(
    sendSessionId: sendSessionId,
    securityContext: securityContext
  ),
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM