Code Monkey home page Code Monkey logo

bolt-oauth's People

Contributors

asopinka avatar eransch avatar jacklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bolt-oauth's Issues

this.receiver.init is not a function

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. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.