DEV Community


Discussion on: How to handle content previews from Sanity in Nuxt

ovsw profile image
Ovi Savescu

Awesome stuff! I'm struggling with how to handle making authenticated requests to Sanity (with API token) for previews.
Would really appreciate it if you could explain the best way to go about that (without exposing the token client-side or fetching previews during the static generation).

ovsw profile image
Ovi Savescu • Edited

OMG, I managed to completely miss / misread the part about "withCredentials: true", which does precisely what I need. I only realized after I came up with a dubious temporary workaround that involved passing the token in the query (don't do that).
To boot, I was logged out from the deployed sanity instance, only logged into the localhost one, so withCredentials wasn't working.


Forem Open with the Forem app