Hi Storyblok team
I'm trying to follow best practices by not exposing my Storyblok API token to the frontend, and I want to keep it strictly server-side.
However, when using the Next.js + Storyblok blueprint and setting up the API as follows:
import { apiPlugin, storyblokInit } from "@storyblok/react/rsc";
export const getStoryblokApi = storyblokInit({
accessToken: process.env.STORYBLOK_DELIVERY_API_TOKEN,
use: [apiPlugin],
components: {},
});
...I get this error in the console:
You need to provide an access token to interact with Storyblok API.
Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication
I confirmed that process.env.STORYBLOK_DELIVERY_API_TOKEN is defined and working
The issue only occurs unless I rename the variable to NEXT_PUBLIC_STORYBLOK_TOKEN, which I don't want to do for security reasons.
I'm using your boilerplate and didnt change anything.
Hi Storyblok team
I'm trying to follow best practices by not exposing my Storyblok API token to the frontend, and I want to keep it strictly server-side.
However, when using the Next.js + Storyblok blueprint and setting up the API as follows:
import { apiPlugin, storyblokInit } from "@storyblok/react/rsc";
export const getStoryblokApi = storyblokInit({
accessToken: process.env.STORYBLOK_DELIVERY_API_TOKEN,
use: [apiPlugin],
components: {},
});
...I get this error in the console:
You need to provide an access token to interact with Storyblok API.
Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication
I confirmed that process.env.STORYBLOK_DELIVERY_API_TOKEN is defined and working
The issue only occurs unless I rename the variable to NEXT_PUBLIC_STORYBLOK_TOKEN, which I don't want to do for security reasons.
I'm using your boilerplate and didnt change anything.