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

Make API calls inside Electron (VSCode) #1009

Closed
LasaleFamine opened this issue Oct 11, 2018 · 6 comments
Closed

Make API calls inside Electron (VSCode) #1009

LasaleFamine opened this issue Oct 11, 2018 · 6 comments

Comments

@LasaleFamine
Copy link

LasaleFamine commented Oct 11, 2018

Hi there and firstly thanks for the amazing product that is Sanity, really, awesome work! 👍

My problem is related to the CORS: I'm trying to get releases informations about a VSCode extension of mine and display them inside a VSCode webview as changelogs. The problem is that I'm getting a CORS error related to the obviously null origin that came from Electron request:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Is there any way to solve this problem?

@kmelve
Copy link
Member

kmelve commented Oct 16, 2018

Thanks @LasaleFamine – and what a cool way to use Sanity!

I tried forking and starting up the VSCode ext. project locally to see what's going on, but it stopped on the get-remote-icons-task because I haven't the correct credentials.

A short in the dark, but maybe this thread can give some clues? electron/electron#7931 (comment)

@LasaleFamine
Copy link
Author

LasaleFamine commented Oct 16, 2018

Hi @kmelve, thanks for your response.

I think actually I can't access the Electron APIs from inside VSCode, see: microsoft/vscode#3011

I'm wondering: is there any way to "fake" the Origin header before make any calls from the Sanity client? In this way I can emulate the solution mentioned on the Electron issue and just add that specific origin within my Sanity configuration for authentication. Do you think this is possible?

@kmelve
Copy link
Member

kmelve commented Oct 16, 2018

I understand – we're looking into how we can better accommodate for your kind of use. There are suggestions on the table, but we just need to evaluate them. Stay tuned!

@LasaleFamine
Copy link
Author

Hi guys, sorry for bothering you, but are there any news about this one?

@kmelve
Copy link
Member

kmelve commented Nov 10, 2018

It's no bother at all @LasaleFamine! This is definitely on the agenda. We are just considering the security implications and how to make it easy for everyone to keep their users safe.

If you come by our slack and DM me, we'll make the wait worth your while!

@rexxars
Copy link
Member

rexxars commented Dec 13, 2018

We now support wildcards, file origins (file:///* explicitly) and null as a value!

@rexxars rexxars closed this as completed Dec 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants