microauth-slack
Slack oauth for micro
Add slack 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-slack# or yarn add microauth-slack
Usage
app.js
const send = ;const microAuthSlack = ; const options = clientId: 'CLIENT_ID' clientSecret: 'CLIENT_SECRET' callbackUrl: 'http://localhost:3000/auth/slack/callback' path: '/auth/slack' scope: 'identity.basic,identity.team,identity.avatar'; const slackAuth = ; // Third `auth` argument will provide error or result of authentication// so it will { err: errorObject} or { result: {// provider: 'slack',// accessToken: 'blahblah',// info: userInfo// }}const handler = async { if !auth return ; if autherr // Error handler console; return ; // Save something in database here return `Hello `; }; moduleexports = ;
Run:
micro app.js
Now visit http://localhost:3000/auth/slack