Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron CORS Gmail/iCloud #216

Open
maksimlya opened this issue Sep 23, 2024 · 2 comments
Open

Electron CORS Gmail/iCloud #216

maksimlya opened this issue Sep 23, 2024 · 2 comments

Comments

@maksimlya
Copy link

Hi, I am on Electron env. My calendar lib is located on the renderer process, therefore 'fetch' does throws CORS for Gmail/iCloud.

I am using XHR tunnel in my project for such cases, so that any XMLHttpRequest goes through tunnel to main thread and executes the request there.

Is there any standard way to tell this lib to use XHR instead of fetch? I did not find a quick way.

*Please do not suggest me to move the lib completely to main thread as we support all platforms and it's not quite easy to do, I'd rather implement manual patches in all request places if needed.

@natelindev
Copy link
Owner

will add XMLHttpRequest in future version

@4x10m
Copy link

4x10m commented Jan 27, 2025

Hi, I am on Electron env. My calendar lib is located on the renderer process, therefore 'fetch' does throws CORS for Gmail/iCloud.

I am using XHR tunnel in my project for such cases, so that any XMLHttpRequest goes through tunnel to main thread and executes the request there.

Is there any standard way to tell this lib to use XHR instead of fetch? I did not find a quick way.

*Please do not suggest me to move the lib completely to main thread as we support all platforms and it's not quite easy to do, I'd rather implement manual patches in all request places if needed.

Hi, i don't think the problem is "fetch is better than xhr".
You need to be clear on what errors are produced here.
The fact is that im fighting against my browser to be able to add events to a caldav server from javascript. I had MANY errors related with preflight request/CORS and xhr was not doing better than fetch.
The real problem here is that browser are not allowed to make PROPFIND request so easily and i guess its the same for the renderer thread of electron.
What im doing was hightly trivial in node but is absolutely harder with browser context since you need to dig a lot of docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants