A Seneca.js a seneca-auth plugin
This plugin is used by seneca-auth for authenticating via github login. It uses PassportJS. The seneca-auth is the authentication plugin used by Seneca toolkit.
For a gentle introduction to Seneca itself, see the senecajs.org site.
If you're using this plugin module, feel to contact on twitter if you have any questions! :) @rjrodger
seneca-github-auth's source can be read in an annotated fashion by,
- running
npm run annotate
- viewing online.
The annotated source can be found locally at here.
npm install seneca-github-auth
When using seneca-auth the github auth must be initialized using:
..........
service: {
"local": {},
"github" : {
"clientID" : "your client id",
"clientSecret" : "app secret",
"urlhost" : "server host",
"serviceParams": {
"scope" : [
.....
]
}
}
}
..........
Note: serviceParams can be used to pass any other parameter to the passport github strategy. More information can be found in the Github documentation.
There is provided a default seneca action that will prepare user data to a more convenient structure. If this data structure is not matching the expected user data structure used by your application, you can overwrite the seneca action and implement your own github_login_data action.
- {role: 'auth', prepare: 'github_login_data'}
The JSON object provided for this actions contains following data from Github login:
- accessToken
- refreshToken
- profile
Note: You can provide also the callbackUrl as part of the options. If not provided then a default value is used.
Default value for callbackUrl: '/auth/github/callback'
Copyright Nicolas Herment and other contributors 2015, Licensed under MIT.