Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)}`);
});