I get a 401 error in the console when I open the preview of a page for the “Live” preview environment.
I assume the problem is that the preview wants to use the public token for the draft version.
I set up the preview environment “Live” that points to the live URL and a stage “Live” next to the default “Preview”.
I assigned API keys to the Live stage – both a public and a preview key. The preview stage has a preview key.
The preview for the “Live” URL always tries to make a request with the “public (Live)” key and always gets a 401 error.
The request goes to https://api.storyblok.com/v2/cdn/stories/landing-pages/test-page?version=draft&language=en&resolve_relations=LandingPageSection.story&token=<public (Live) token>
The preview of the default “preview” URL works.
But that goes against my localhost.
I want stakeholders to see the live page in the preview screen.
What am I doing wrong?
Can I control which token the preview URL uses?
I’m using Nuxt.js as static site. The preview first shows the correct page for a split second (the pre-rendered static files) and then tries to make the Storyblok calls to preview draft content – that results in a 401 and the page shows an error.