Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

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?