« first day (4934 days earlier)   

12:32 AM
@MileMijatović there either isn't a header Set-Cookie in the response headers by default, or you're using the wrong request method. If you intended to use a GET request, then that's not the issue. I think the issue is that the header doesn't exist or isn't set.
const elements = [
  { className: 'voteComment', idPrefix: 'txtVoteComment' },
  { className: 'voteYes', idPrefix: 'txtVoteYes' },
  { className: 'voteNo', idPrefix: 'txtVoteNo' },
  { className: 'voteAbstain', idPrefix: 'txtVoteAbstain' },
  { className: 'voteAbsent', idPrefix: 'txtVoteAbsent' }
];

elements.forEach((element, index) => {
  const el = input_group.querySelector(`.${element.className}`);
  el.value = '';
  el.id = `${element.idPrefix}_${index}`;
});
@Jefferson ^
 
 
3 hours later…
3:11 AM
||joke
 
A SQL query walks into a bar, walks up to two tables and asks...
'Can I join you?'
 
['hip', 'hip']
(hip hip array)
 
3:30 AM
!!towc
 
Invalid command! Did you mean: coc, wow, tomm? Try help for a list of available commands.
 
4:05 AM
||wow
 
||WOW
||coc
 
||obama James is a cool bot
Obama command no longer works.
 
 
2 hours later…
6:06 AM
Hi guys, anyone free to have a quick discussion about a doubt I have on React Suspense
 
 
1 hour later…
7:16 AM
@ParkingMaster I am trying to handle express-session from express.js app on frontend app
export const login = asyncHandler(
  async (req: Request<ILogin>, res: Response<IResponse>) => {
    const token = await UserService.authenticate(req.body);

    req.session.token = token;

    return res
      .status(200)
      .json({ success: true, message: messages.auth.loggedIn });
  }
);
I have successfully saving jwt token in MongoDB collection (sessions) by using MongoStore
// Configure session
app.use(
  session({
    name: config.session.name,
    secret: config.session.secret as string,
    resave: false,
    saveUninitialized: false,
    store,
    cookie: {
      httpOnly: isProduction,
      secure: isProduction,
      maxAge: +config.session.cookie.expiration
    }
  })
);
after successfully logging in , session for that user is saved in DB, like this

{"cookie":{"originalMaxAge":900000,"expires":"2024-04-19T07:35:27.946Z","secure":true,"httpOnly":true,"path":"/"},"token":"jwt_token_here"}
But how to use that sessionId and cookie on frontend application , to authenticate user on UI , not just on server side ?
 
7:41 AM
@ParkingMaster

this is my auth.middleware from server side app

import { NextFunction, Request, Response } from 'express';
import messages from '../assets/json/messages.json';
import { AuthenticationError } from '../errors';
import config from '../config/env';
import { verifyToken } from '../utils';

const requireAuth = async (req: Request, res: Response, next: NextFunction) => {
  try {
    if (!req.session || !req.session.token) {
      return next(new AuthenticationError(messages.auth.unauthorized));
What should I do on frontend app to use that authentication session successfully ?
 

« first day (4934 days earlier)