Answer the question
In order to leave comments, you need to log in
ERR_HTTP_HEADERS_SENT: Cannot set cookie?
this is my code
import { Request, Response } from "express";
import { database } from "firebase-admin";
async function updatereAccessToken(
req: Request,
res: Response,
db: database.Database
) {
try {
await db
.ref(
`/token/${"-MUQK0wGmrjPVBdFH7gr"}/${"90417abf-b085-4072-b4ec-f009b5fe4016"}`
)
.set("90417abf-b085-4072-b4ec-f009b5fe4016");
await db
.ref(
`/token/${"-MUQK0wGmrjPVBdFH7gr"}/${"90417abf-b085-4072-b4ec-f009b5fe4016"}`
)
.set("90417abf-b085-4072-b4ec-f009b5fe4016");
//comments
res.cookie("act", "tokenAuth.accessToken", {
httpOnly: true,
sameSite: "lax",
});
res.cookie("ret", "tokenAuth.refreshToken", {
httpOnly: true,
sameSite: "lax",
});
return "currentUser";
} catch (error) {}
}
[ERR_HTTP_HEADERS_SENT]: невозможно установить заголовки после их отправки клиенту на ServerResponse.setHeader (_http_outgoing.js: 558: 11)
await db
.ref(
`/token/${"-MUQK0wGmrjPVBdFH7gr"}/${"90417abf-b085-4072-b4ec-f009b5fe4016"}`
)
.set("90417abf-b085-4072-b4ec-f009b5fe4016");
await db
.ref(
`/token/${"-MUQK0wGmrjPVBdFH7gr"}/${"90417abf-b085-4072-b4ec-f009b5fe4016"}`
)
.set("90417abf-b085-4072-b4ec-f009b5fe4016");
res.cookie("act", "tokenAuth.accessToken", {
httpOnly: true,
sameSite: "lax",
});
res.cookie("ret", "tokenAuth.refreshToken", {
httpOnly: true,
sameSite: "lax",
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question