asopinka / bolt-oauth Goto Github PK
View Code? Open in Web Editor NEWA library to assist you with OAuth when using Slack's Bolt framework.
License: MIT License
A library to assist you with OAuth when using Slack's Bolt framework.
License: MIT License
I receive this.receiver.init is not a function. Using it like this
const { App } = require("@slack/bolt");
const Auth = require("bolt-oauth");
const oauthSuccess = ({ res, oAuthResult }) => {
console.log(oAuthResult);
// save oAuthResult in MongoDB or somewhere else permanent since it has all the tokens
res.redirect("<successfully_installed_thankyou_page_url>");
};
const oauthError = error => {
// do something about that error to let the user know
};
const oauthStateCheck = oAuthState => {
// check the parameter state against your saved state to ensure everything is ok
return true;
};
const authorizeFn = ({ teamId, enterpriseId, userId, conversationId }) => {
// go to your MongoDB or wherever you've stored the tokens and get the values based on teamId and/or userId
return true;
};
const app = new App({
//token: process.env.SLACK_BOT_TOKEN,
//signingSecret: process.env.SLACK_SIGNING_SECRET
authorize: authorizeFn,
receiver: Auth({
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
signingSecret: process.env.SLACK_SIGNING_SECRET,
redirectUrl: process.env.SLACK_REDIRECT_URL,
stateCheck: oauthStateCheck,
onSuccess: oauthSuccess,
onError: oauthError,
useSlackOauthV2: false
})
});
```
By the way thanks for this. There is no good way how to create a public Slack App with Bolt. I hope this works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.