microauth-twitter
Twitter oauth for micro
Add twitter authentication to your micro service as easy as a flick of your fingers. This module is a part of microauth collection.
Installation
npm install --save microauth-twitter# or yarn add microauth-twitter
Usage
app.js
const send = ;const microAuthTwitter = ; const options = consumerKey: 'CONSUMER_KEY' consumerSecret: 'CONSUMER_SECRET' callbackUrl: 'http://localhost:3000/auth/twitter/callback' path: '/auth/twitter'; const twitterAuth = ; // third `auth` argument will provide error or result of authentication// so it will { err: errorObject} or { result: {// provider: 'twitter',// accessToken: 'blahblah',// accessTokenSecret: 'blahblah',// info: userInfo// }}const handler = async { if !auth return ; if autherr // Error handler return ; // save something in database here return `Hello `; }; moduleexports = ;
Run:
micro app.js
Now visit http://localhost:3000/auth/twitter