processing / processing/p5.js

Add 'credentials: include' to fetch request in loadImage()

Open
#4,499 10 comments 2 reactions 1 assignee View on GitHub

@Ashley-Y-Lin is already working on this.

Since Mar 27, 2023.

Area:Image Feature Request
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Color
  • Core/Environment/Rendering
  • Data
  • Dom
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)
New feature details:

I recently found an issue with p5.js loadImage() and how the fetch() request handled cookies in Safari (macOS/iOS) and Chrome (iOS). Due to Apple-specific security features, cookies were not being attached for image requests.

I'm using Express.js middleware to manage user sessions/issue cookies and the requests from loadImage() were not aware of the session cookie, causing the request to fail. This can evidently be fixed by including credentials: include in the fetch request.

If possible, this would be a useful addition to the library for others who encounter a similar situation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.