Quantcast
Channel: Can't set a cookie using NextJS 9's API Route - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Chukwuemeka Maduekwe for Can't set a cookie using NextJS 9's API Route

I just found an easier way to do this in Next.js, though with a library -- cookie-nextrun npm install --save cookies-nextIf you are using next.js version greater than 12.2.0 you need to use...

View Article



Answer by Kevin Law for Can't set a cookie using NextJS 9's API Route

Adapted from offical repo middleware example, you can set Set-Cookie header via res like so:import { serialize } from 'cookie';function (req, res) { // ... // setHeader(headerName: string, cookies:...

View Article

Can't set a cookie using NextJS 9's API Route

Typically it seems that when using Express, in the "res" object there is "cookie" so you can do something like:res.cookie('session', sessionCookie, options);In the API routes offered by NextJS in Next...

View Article
Browsing all 3 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>