Похожие чаты

Async login(req: Request, res: Response, next: NextFunction): Promise<void> {

try {
const { errors, input } = await RequestValidator(LoginRequest, req.body);
if (errors) {
throw new AuthFailureError(errors as string);
}

const response = await this.authService.login(input);
const cookies = req.cookies;
if (cookies && cookies[config.TOKEN_INFO.refreshTokenName]) {
const tokenExsists = await this.tokenService.checkRefreshToken(cookies[config.TOKEN_INFO.refreshTokenName], response.user.id as string);
if (tokenExsists) {
await this.tokenService.deleteToken(cookies[config.TOKEN_INFO.refreshTokenName], response.user.id as string);
}
res.clearCookie(
config.TOKEN_INFO.refreshTokenName,
clearRefreshTokenCookieConfig
);
}

const accessToken = await this.tokenService.generateAccessToken({ userId: response.user.id as string });
const refreshToken = await this.tokenService.generateRefreshToken({ userId: response.user.id as string });
await this.tokenService.saveToken(refreshToken, response.user.id as string);

// res.cookie(
// config.TOKEN_INFO.refreshTokenName,
// refreshToken,
// refreshTokenCookieConfig
// )


res.setHeader('Set-Cookie', refreshToken=${refreshToken}; HttpOnly; Path=/; Max-Age=${config.TOKEN_INFO.refreshTokenValidityDays}; SameSite=None; Secure; Partitioned);
const result = {
userId: response.user.id,
accessToken
}
new SuccessResponse('User logged in successfully', { ...result }).send(res);
} catch (error) {
next(error);
}
}


any one know why this is not setting the cookies in the nextjs frontend? it is working fine in postman

1 ответов

87 просмотров

1. add tree ` in start and end of code to format it like code. it will be like this const div = document.createElement("div");

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Мелодичный Сырник
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Фетровый Лингвист
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Настойчивый Кварк
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
Льдистая Лужица
2
30500 за редактор? )
Замшевый Алхимик
47
а через ESC-код ?
Виноградная Притча
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Звенящий Циферблат
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Туманный Ларец
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Длинный Минерал
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Тягучая Ракушка
11
Карта сайта