Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 2.1 KB

README.md

File metadata and controls

67 lines (44 loc) · 2.1 KB

seneca-twitter-auth - a seneca-auth plugin

This plugin is used by seneca-auth for authenticating via twitter 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-twitter-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 ./docs/twitter-auth.html.

Install

npm install seneca-twitter-auth

Using Twitter Auth

When using seneca-auth the twitter auth must be initialized using:

..........
    service: {
      "local": {},
      "twitter" : {
        "apiKey" : "TWITTER_KEY",
        "apiSecret" : "TWITTER_SECRET",
        "urlhost" : "http://localhost:3000"
      }
    }
..........

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 twitter-login-data action.

  • {role: 'auth', prepare: 'twitter_login_data'}

The JSON object provided for this action contains following data from Twitter login:

  • accessToken
  • tokenSecret
  • 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/twitter/callback'

Register your app on twitter

License

Copyright Mircea Alexandru and other contributors 2016, Licensed under MIT.