Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Using tokens in the browser

Using a Sanity token in JavaScript that is consumed by a browser is usually a really bad idea unless you take extra precautions to protect it from unauthorized users.

Please make sure to read about how to keep your data safe.

If you are absolutely sure you know what you are doing and have taken steps to protect the access token from leaking, you can disable the warning in the sanity client by setting the option ignoreBrowserTokenWarning to true, for example:

const sanityClient = require('@sanity/client');

const client = sanityClient({
dataset: '<dataset name>',
token: '<secret token>', ignoreBrowserTokenWarning: true });

Was this article helpful?