meteoroauthslackaccounts

Meteor - Slack oAuth2 Accounts.LoginCancelledError


I am using in my Meteor application Slack package: acemtp:accounts-slack and Sign in with Slack button. Unfortunately I am getting an error and cannot login. I am getting following error in console:

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

Button redirects me to the following 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

and response is: 404 File Not Found

I've already added to my Slack application following redirect urls: http://localhost:3000/_oauth/slack?close http://localhost:3000/

Unfortunately it does not work. I am not sure what happened. It was working week ago and stopped yesterday. Users can't sign in.

This is my loginWithSlack method:

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);
                    }
                });
            }
        });

Solution

  • The '?' in the redirect_uri is no longer accepted by Slack as a valid character. You can remove it by configuring the loginStyle property when configuring your Slack service (in your server side application code) :

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

    Link is here : http://docs.meteor.com/api/accounts.html#service-configuration

    For more details, you can check this issue out too : https://github.com/meteor/meteor/issues/2758

    Hope this helps!