Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @ts-ignore
import { express as grantExpress } from 'grant';
import Debug from 'debug';
import session from 'express-session';
import { Application } from '@feathersjs/feathers';
import { AuthenticationResult } from '@feathersjs/authentication';
import qs from 'querystring';
import {
Application as ExpressApplication,
original as express
} from '@feathersjs/express';
import { OauthSetupSettings } from './utils';
import { OAuthStrategy } from './strategy';
const grant = grantExpress();
const debug = Debug('@feathersjs/authentication-oauth/express');
export default (options: OauthSetupSettings) => {
return (feathersApp: Application) => {
const { authService, linkStrategy } = options;
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),