Skip to content

Storyblok API Token in #10

@tailwindtom

Description

@tailwindtom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions