How to use the @feathersjs/express.original function in @feathersjs/express

To help you get started, we’ve selected a few @feathersjs/express examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feathersjs / feathers / packages / authentication-oauth / src / express.ts View on Github external
const app = feathersApp as ExpressApplication;
    const config = app.get('grant');

    if (!config) {
      debug('No grant configuration found, skipping Express oAuth setup');
      return;
    }

    const { path } = config.defaults;
    const expressSession = options.expressSession || session({
      secret: Math.random().toString(36).substring(7),
      saveUninitialized: true,
      resave: true
    });
    const grantApp = grant(config);
    const authApp = express();

    authApp.use(expressSession);

    authApp.get('/:name', (req, res) => {
      const { feathers_token, ...query } = req.query;
      const { name } = req.params as any;

      if (feathers_token) {
        debug(`Got feathers_token query parameter to link accounts`, feathers_token);
        req.session.accessToken = feathers_token;
        req.session.query = query;
      }

      res.redirect(`${path}/connect/${name}?${qs.stringify(query)}`);
    });