✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Using listener with tokens is not supported in browsers

The browser implementation of EventSource does not allow for sending custom headers. Therefore, authenticating a listener request using a token will not work in browsers.

Gotcha

Configuring the sanity client using a token in the browser has security implications, and should only be done after a careful consideration.

Read more about how to keep your data safe

Instead consider setting the visibility of your dataset to public or make sure users are logged in using cookies when accessing your frontend.

Was this article helpful?