message: fix(authentication-oauth): Make oAuth authentication work with cookie-session
diff: @@ -56,6 +56,7 @@ export default (options: OauthSetupSettings) => {
  req.session.redirect = redirect as string;
  req.session.query = query;
  req.session.headers = req.headers;
  + if (typeof(req.session.save) === 'function') {
  req.session.save((err: any) => {
  if (err) {
  next(`Error storing session: ${err}`);
  @@ -63,6 +64,10 @@ export default (options: OauthSetupSettings) => {
  next();
  }
  });
  + }
  + else {
  + next();
  + }
  });
  authApp.get('/:name/authenticate', async (req: Request, res: Response, next: NextFunction) => {
  @@ -107,12 +112,13 @@ export default (options: OauthSetupSettings) => {
  };
  await new Promise<void>((resolve, reject) => {
  - if (!req.session.destroy) {
  + if (req.session.destroy) {
  + req.session.destroy((err: any) => err ? reject(err) : resolve());
  + }
  + else {
  req.session = null;
  resolve();
  }
  -
  - req.session.destroy((err: any) => err ? reject(err) : resolve());
  });
  debug(`Calling ${authService}.create authentication with strategy ${name}`);
  