Setting cookies in API route handlers doesn't work
Answered
Balinese posted this in #help-forum
BalineseOP
I'm having trouble trying to set cookies for my tokens received from a custom server (FastAPI). The response payload seems to be getting through but
cookies().set() just doesn't work. I've also tried using res.cookies.set(), doesn't work either. Am I doing something wrong here?Answered by Balinese
I had to manually pass in the headers to the
NextResponse since I'm using middleware because the Set-Cookie header was required to perform the cookies setting.2 Replies
BalineseOP
Up
BalineseOP
I had to manually pass in the headers to the
NextResponse since I'm using middleware because the Set-Cookie header was required to perform the cookies setting.Answer