Login and set cookies - that is correct?
Answered
Oriental Greenfinch posted this in #help-forum
Oriental GreenfinchOP
Hi.
I'm trying to create a login page, using Next 14 and actions.
I have a login page with a button calling a function in a action.ts (use server).
In API, i am using response.setCookie (NestJs) but not workin using server actions.
This login function return a JWT token and a use cookies().set to save to cookies.
That is corret way to do this?
(sorry for bad english, trying to learn another language)
I'm trying to create a login page, using Next 14 and actions.
I have a login page with a button calling a function in a action.ts (use server).
In API, i am using response.setCookie (NestJs) but not workin using server actions.
This login function return a JWT token and a use cookies().set to save to cookies.
That is corret way to do this?
(sorry for bad english, trying to learn another language)
Answered by Ray
yes we can use
cookies() function to set the cookie with server action