流星 - Slack oAuth2 Accounts.LoginCancelledError

Meteor - Slack oAuth2 Accounts.LoginCancelledError

我在我的 Meteor 应用程序 Slack 包中使用:acemtp:accounts-slack 并使用 Slack 按钮登录。不幸的是,我遇到错误,无法登录。我在控制台中收到以下错误:

"No matching login attempt found",
errorType: "Accounts.LoginCancelledError"

按钮将我重定向到以下 link:https://slack.com/oauth/authorize?client_id=188243231058.189281460071&response_type=code&scope=identity.basic,identity.email,identity.avatar&redirect_uri=http://localhost:3000/_oauth/slack?close&state=eyJsb2dpblN0eWxlIjoicG9wdXAiLCJjcmVkZW50aWFsVG9rZW4iOiIzWktaaWFhdGNRNkpheld5WiIsImlzQ29yZG92YSI6ZmFsc2V9

响应为:404 未找到文件

我已经在重定向 URL 之后添加到我的 Slack 应用程序中: http://localhost:3000/_oauth/slack?close http://localhost:3000/

不幸的是,它不起作用。我不确定发生了什么。它在一周前工作,昨天停止了。用户无法登录。

这是我的 loginWithSlack 方法:

Meteor.loginWithSlack({requestPermissions: ["identity.basic", "identity.email", "identity.avatar"]}, (error) => {
            if (error) {
                $notification({
                    type: 'error',
                    title: 'Signup with slack error',
                    message: error.error ? error.error.message : JSON.stringify(error)
                });
                console.log(error);
                slackLog.error(error);
            } else {
                this.$router.push({name: 'home'})
                Meteor.call('loginSlackUpdate', (error) => {
                    if (error) {
                        $notification({
                            type:'warning',
                            title: "Error activating account",
                            message: error.error ? error.error.message : JSON.stringify(error)
                        });
                        slackLog.error(error);
                    }
                });
            }
        });

'?'在 redirect_uri 中不再被 Slack 接受为有效字符。您可以在配置 Slack 服务时(在您的服务器端应用程序代码中)通过配置 loginStyle 属性 来删除它:

ServiceConfiguration.configurations.upsert(
  { service: 'slack' },
  {
    $set: {
      loginStyle: "redirect",
      clientId: "1292962797", // See table below for correct property name!
      secret: "75a730b58f5691de5522789070c319bc"
    }
  }
);

Link 在这里:http://docs.meteor.com/api/accounts.html#service-configuration

更多详细信息,您也可以查看此问题:https://github.com/meteor/meteor/issues/2758

希望对您有所帮助!