Next.js Discord

Discord Forum

ISR auth

Unanswered
Purple Martin posted this in #help-forum
Open in Discord
Purple MartinOP
Hi all

I'm trying to setup ISR for some pages on my app.

To fetch the list of dynamic slugs, I'm making a call toward my API. This call is authenticated.

I'm using logto to handle authentication and retrieve my access token. Unfortunately, logto uses cookies()under the hood, which results in the following error:

Error: cookies was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context

How can I make an authenticated call toward my API so that I can build static pages, since the access toekn is stored in my cookies ?

0 Replies