The setup I have built for a Gatsby site seems to only work for content that has been published, and only when a Prismic CMS user is logged in. But, sometimes the preview seems to work even after I have logged out of the CMS (notably with Firefox). Jump to another browser, Safari, and no preview.
Which is the case? Preview when logged in or when someone has the preview link? I have followed the steps and have used 'V4 of our Gatsby + Prismic integration'.
So as you said Previews only work for logged in Prismic users.
They function by using browser cookies. The Prismic dashboard generates the cookies in your browser and passes in in your browser's tabs to the correct place, this is why only the current user can see it and you don't see it in another browser.
When you create a shareable link you create a link that can fetch the cookie and allow any users with that link to see the Preview in their browser.
If you are seeing unpublished content then you likely need to load the preview script in your 404 or update your linkresolver as described here: