Next.js Discord

Discord Forum

Next.13.5, which cookie package to use

Answered
Almond stone wasp posted this in #help-forum
Open in Discord
Almond stone waspOP
I am doing user authentication and really confused on which cookie package to use. I see there is one built in with next/headers, but then I need to use only in server components and set the next.config.js to: experimental: {
serverActions: true,
},
Is this right.? I am super confused on what I should use. I just want to register/login users to Strapi if that matters...
At first I was trying to use Cookies from js-cookie. But maybe thats outdated for this version of next? Help!
Answered by B33fb0n3
In the past I used this package (clientside and serverside): https://www.npmjs.com/package/cookies-next
View full answer

7 Replies

Pollock
serverActions are stable already
In the past I used this package (clientside and serverside): https://www.npmjs.com/package/cookies-next
Answer
Another thing you want to consider is using the cookies from next FROM YOUF SERVER COMPONENTS or API endpoints: https://nextjs.org/docs/app/api-reference/functions/cookies
by the way: server actions are stable 🙂 @Almond stone wasp
@B33fb0n3 In the past I used this package (clientside and serverside): https://www.npmjs.com/package/cookies-next
Almond stone waspOP
thank you, will look into. Do I need to update to another version to use serveractions?
@Almond stone wasp thank you, will look into. Do I need to update to another version to use serveractions?
Ideally you'd update to Nextj14 since server action is stable starting in that version
@Almond stone wasp thank you, will look into. Do I need to update to another version to use serveractions?
Yea, like Alfonsus said, starting from next 14 server actions are stable

please mark solution