- private sessionStore: SessionStore;
+ private jwtSecret: string;
+ private tokenExpiry: string = '24h';
- const session = await this.sessionStore.create(req.body);
- return res.cookie('sid', session.id);
+ const user = await this.validateCredentials(req.body);
+ const token = jwt.sign({ sub: user.id }, this.jwtSecret, {
+ expiresIn: this.tokenExpiry
+ });
+ return res.json({ token });