Hi! Thanks for sharing this great starter kit! The only thing is I'm having an issue with a 401 error when I use a variable from .env.local as the accessToken value in the prismic-configuration.js
// -- Access Token if the repository is not public // Generate a token in your dashboard and configure it here if your repository is private accessToken: '',
The problem with this is that if I add my private accessToken here it will be available in the browser.
So I created a .env.local file with my accessToken in it and added it to the prismic-configuration.js this way instead:
// -- Access Token if the repository is not public // Generate a token in your dashboard and configure it here if your repository is private accessToken: 'process.env.PRISMIC_API_TOKEN',
But I'm getting this error:
GET https://my-website.cdn.prismic.io/api/v2 401
Also to note that the error is gone when I prefix my .env.local variable with NEXT_PUBLIC_
https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser
Confirming that the accessToken is needed in the browser for the code to work. I found that the Client
function which needs the accessToken is being called from homepageToolbarDocs
and pageToolbarDocs
and both are used inside their respective components causing the error. I'm not sure but maybe there is another way to update the prismic toolbar?