How to use the @feathersjs/authentication-local function in @feathersjs/authentication-local

To help you get started, we’ve selected a few @feathersjs/authentication-local 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 feathers-plus / generator-feathers-plus / test-expands / a-gens / ts / test-service.test-expected / src1 / authentication.ts View on Github external
let moduleExports = function (app: App) {
  const config = app.get('authentication');
  // !code: func_init // !end

  // Set up authentication with the secret
  app.configure(authentication(config));
  app.configure(jwt());
  app.configure(local());
  // !code: loc_1 // !end

  app.configure(oauth2(Object.assign({
    name: 'auth0',
    Strategy: Auth0Strategy,
    // !code: auth0_options // !end
  }, config.auth0)));

  app.configure(oauth2(Object.assign({
    name: 'google',
    Strategy: GoogleStrategy,
    // !code: google_options // !end
  }, config.google)));

  app.configure(oauth2(Object.assign({
    name: 'facebook',
github nesterow / frontless / components / server.js View on Github external
enabled: true,
    name: COOKIE_NAME,
    httpOnly: false,
    secure: false
  },
  jwt: {
    header: { typ: 'access' },
    audience: ORIGIN,
    subject: 'authentication',
    issuer: 'frontless',
    algorithm: 'HS256',
    expiresIn: '10d' // the access token expiry
   },
}))

app.configure(local({
  session: true,
  usernameField: 'username',
  passwordField: 'password',
  entityUsernameField: 'username', 
  entityPasswordField: 'password',
  Verifier,
}))

const dir = __dirname + '/..'
app.emit('setup:ssr', app)
app.use('/*@:args',  Frontless(dir, ['styles']))
app.use('/*',  Frontless(dir, ['styles']))

app.use((err, req, res, next) => {
  const {type, code} = err;
  if (type === 'FeathersError') {
github feathers-plus / generator-feathers-plus / examples / ts / 05-secret / feathers-app / src / authentication.ts View on Github external
let moduleExports = function (app: App) {
  const config = app.get('authentication');

  // Set up authentication with the secret
  app.configure(authentication(config));
  app.configure(jwt());
  app.configure(local());
  // !code: loc_1 // !end

  app.configure(oauth2(Object.assign({
    name: 'auth0',
    Strategy: Auth0Strategy
  }, config.auth0)));

  app.configure(oauth2(Object.assign({
    name: 'google',
    Strategy: GoogleStrategy
  }, config.google)));

  app.configure(oauth2(Object.assign({
    name: 'facebook',
    Strategy: FacebookStrategy
  }, config.facebook)));
github nesterow / frontless / lib / server.js View on Github external
//   corsMiddleware(socket.request, socket.request.res, next);
    // });
    io.use(function(socket, next) {
      sessionMiddleware(socket.request, socket.request.res, next);
    });
    io.use(function(socket, next) {
      socket.feathers.request = socket.request;
      next();
    });
  }));
  app.configure(authentication({
    session: true,
    secret: process.env.REST_AUTH_SECRET,
    service: process.env.REST_AUTH_SERVICE,
  }));
  app.configure(local());

  configure(app, express);
  app.use('/*', FrontLessMidleware);
  services(app);
  return app;
};
github DefinitelyTyped / DefinitelyTyped / types / feathersjs__authentication-local / feathersjs__authentication-local-tests.ts View on Github external
import feathers, { Application } from '@feathersjs/feathers';
import feathersAuthenticationLocal from '@feathersjs/authentication-local';

const app: Application = feathers().configure(feathersAuthenticationLocal());
github nesterow / frontless / src / server.js View on Github external
app.use('/assets', express.static('assets'))
app.use(corsMiddleware)
app.use(sessionMiddleware)
app.use(express.json())
app.use(express.urlencoded({extended: true}))

app.configure(express.rest())

app.configure(authentication({
  session: true,
  secret: process.env.REST_AUTH_SECRET,
  service: process.env.REST_AUTH_SERVICE,
}))

app.configure(local())

app.use(function (req, res, next) {
 
  if ('EIO' in req.query)
    return next();
  if (req.headers.accept &&
      req.headers.accept.includes('/json')) {
    return next();
  }
  if (req.feathers &&
    req.feathers.headers.accept.includes('/json')) {
  return next();
}
  renderer(req, res, next);
})
github nesterow / frontless / src / lib / server / index.js View on Github external
app.configure(express.rest());
app.configure(socketio({}, function(io) {
  io.use(function(socket, next) {
    sessionMiddleware(socket.request, socket.request.res, next);
  });
  io.use(function(socket, next) {
    socket.feathers.request = socket.request;
    next();
  });
}));
app.configure(authentication({
  session: true,
  secret: '123sd234sdfsdf',
  service: 'users',
}));
app.configure(local());


/**
 * FrontLess express middleware.
 * Provides methods for parsing frontless HTTP requests and valid responces
 * @param {Object} req - express request
 * @param {Object} res - express response
 * @param {Function} next - express callback
 * @async
 */
export async function FrontLessMidleware(req, res, next) {
  if (req.headers.accept &&
      req.headers.accept.includes('/json')) {
    return next();
  }
  const tagName = resolvePageName(req.params [0]);