Next.js Discord

Discord Forum

How to prevent middleware (response.cookies.set) from url encoding ?

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
so i am trying to set refresh token and access token in the middleware, but i found that it does url encoding automatically

i want to ask is any way to make it don't url encoding automatically?

this is my code:
      response.cookies.set("refreshToken", refreshTokenMatch[1], {
        httpOnly: true,
        expires: refresh_token_expiration_time,
      });

2 Replies

Sun bearOP
i got the another way to do this
response.headers.set("set-cookie", res.headers.get("set-cookie"));