How to use @feathersjs/authentication-oauth2 - 3 common examples

To help you get started, we’ve selected a few @feathersjs/authentication-oauth2 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
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',
    Strategy: FacebookStrategy,
    // !code: facebook_options // !end
  }, config.facebook)));

  app.configure(oauth2(Object.assign({
    name: 'github',
    Strategy: GithubStrategy,
    // !code: github_options // !end
  }, config.github)));

  // !code: loc_2 // !end

  // The `authentication` service is used to create a JWT.
  // The before `create` hook registers strategies that can be used
  // to create a new valid JWT (e.g. local or oauth2)
github feathers-plus / generator-feathers-plus / examples / ts / 05-secret / feathers-app / src / authentication.ts View on Github external
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)));

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

  // !code: loc_2 // !end

  // The `authentication` service is used to create a JWT.
  // The before `create` hook registers strategies that can be used
  // to create a new valid JWT (e.g. local or oauth2)
  app.service('authentication').hooks({
    before: {
      create: [
        authentication.hooks.authenticate(config.strategies),
      ],
      remove: [
        authentication.hooks.authenticate('jwt'),
github DefinitelyTyped / DefinitelyTyped / types / feathersjs__authentication-oauth2 / feathersjs__authentication-oauth2-tests.ts View on Github external
import feathers, { Application } from '@feathersjs/feathers';
import feathersAuthenticationOAuth2, { Verifier, FeathersAuthenticationOAuth2Options } from '@feathersjs/authentication-oauth2';
import { RequestHandler, Response, NextFunction } from 'express';
import { Request } from 'express-serve-static-core';
import { Strategy } from 'passport';
import { Profile as GithubProfile } from 'passport-github';
import { Profile as FacebookProfile } from 'passport-facebook';

const app: Application = feathers().configure(feathersAuthenticationOAuth2());

class CustomVerifier extends Verifier {
    constructor(app: Application, options: any = {}) {
        super(app, options);
    }
}

const handler: RequestHandler = (req: Request, res: Response, next: NextFunction) => { };

class someStrategy extends Strategy {
    something = "foo";
}
/**
 * Strongly Typed Verifier
 */

@feathersjs/authentication-oauth2

An OAuth2 authentication strategy for feathers-authentication using Passport

MIT
Latest version published 6 years ago

Package Health Score

70 / 100
Full package analysis

Popular @feathersjs/authentication-oauth2 functions