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).
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.
Facepalm!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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).
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.
Facepalm!