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

Customizable crossorigin policy in ImageNode to support authentification #1403

Closed
TheBigRoomXXL opened this issue Jan 24, 2024 · 1 comment
Closed

Comments

@TheBigRoomXXL
Copy link

Issue

I use Sigma with NodeImageProgram to render images on the graph, but my images are protected by authentication as they are private. Authentication is managed by cookies that are automatically added by the browser on every request, except for Sigma unfortunately.

This is caused by line 95 of src/rendering/webgl/programs/node.image.ts:

 image.setAttribute("crossOrigin", "");

According to MDN, setting the crossorigin policy to "" is equivalent to setting it to "anonymous" wich prevent the browser from using cookie on the request.

Proposed solution

I would like a way to configure the cross-origin policy so that I can access private images. One place where this could be done is by passing a crossorigin argument to the `getNodeProgramImage' function. Another place where it might make sense is perhaps in the graph setting.

If either of these solutions is okay with you, I can volunteer to make a pull request

Current work around

I tried to copy node.image.ts , update the import and change the crossorigin policy but I get Uncaught (in promise) TypeError: WebGL2RenderingContext.getAttribLocation: Argument 1 is not an object. NodeImageProgram node-image-renderer.ts:242 . gist for reference. I guess my imports are wrong as thats the only thing I changed but I am not sure. Even if that worked I don't think it's future proof as it could easily break with future updates.

Instead I just opened the file in node_module and changed the crossorigin direcly. It works, but it's not a long term solution at all.

Thank you for the work, SigmaJS is an awesome library.

@jacomyal
Copy link
Owner

jacomyal commented Jul 2, 2024

I merged your PR about this issue, thanks a lot for your contribution!

@jacomyal jacomyal closed this as completed Jul 2, 2024
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

2 participants