Skip to content

Latest commit

 

History

History
91 lines (63 loc) · 2.99 KB

README.md

File metadata and controls

91 lines (63 loc) · 2.99 KB

Seneca

A Seneca.js a seneca-auth plugin

seneca-github-auth - a seneca-auth plugin

npm version Build Status Dependency Status Gitter chat

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

About

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.

Install

npm install seneca-github-auth

Using 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.

Other information

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'

License

Copyright Nicolas Herment and other contributors 2015, Licensed under MIT.