fix: use database session cookie for production (#4200)

This commit is contained in:
Peng Xiao
2023-09-06 01:30:50 +08:00
committed by GitHub
parent 8407b2dd7c
commit 1dc94277c2
3 changed files with 21 additions and 3 deletions

View File

@@ -251,4 +251,17 @@ export class AuthService {
async sendChangeEmail(email: string, callbackUrl: string) {
return this.mailer.sendChangeEmail(email, callbackUrl);
}
async getSessionToken(userId: string) {
const session = await this.prisma.session.findFirst({
where: {
userId: userId,
},
});
if (!session) {
throw new BadRequestException(`No session found for user id ${userId}`);
}
return session?.sessionToken;
}
}