feathersjs-ecosystem / authentication-oauth2

[MOVED] OAuth 2 plugin for feathers-authentication
https://github.com/feathersjs/feathers
MIT License
26 stars 15 forks source link

Confusing in doc of 'OAuth2 Authentication' #73

Closed flight9 closed 6 years ago

flight9 commented 6 years ago

Confusing

Options

{
idField: '<provider>Id', // The field to look up the entity by when logging in with the provider. Defaults to '<provider>Id' (ie. 'facebookId').
path: '/auth/<provider>', // The route to register the middleware
callbackURL: 'http(s)://hostname[:port]/auth/<provider>/callback', // The callback url. Will automatically take into account your host and port and whether you are in production based on your app environment to construct the url. (ie. in development http://localhost:3030/auth/facebook/callback)
successRedirect: undefined,
failureRedirect: undefined,
entity: 'user', // the entity that you are looking up
service: 'users', // the service to look up the entity
passReqToCallback: true, // whether the request object should be passed to `verify`
session: false, // whether to use sessions,
handler: function, // Express middleware for handling the oauth callback. Defaults to the built in middleware.
formatter: function, // The response formatter. Defaults the the built in feathers-rest formatter, which returns JSON.
Verifier: Verifier // A Verifier class. Defaults to the built-in one but can be a custom one. See below for details.
}

I wonder where should I put the above 'Options'? Is it an authentication options or an oauth2 options?

// Setup authentication
app.configure(authentication({ secret: 'super secret' })); // <-- here? 
app.configure(jwt());
app.configure(oauth2({ //<-- or here?
name: 'facebook',
Strategy: FacebookStrategy, //<-- or here when initializing FacebookStrategy?
clientID: '<your client id>',
clientSecret: '<your client secret>',
scope: ['public_profile', 'email']
}));
flight9 commented 6 years ago

I found the options seems to be the settings of oauth2

flight9 commented 6 years ago

I hope the doc could be clearer for newbie to read, thanks.