slack-ruby/slack-ruby-bot

Auth suddenly stopped working

snex opened this issue · 9 comments

snex commented

Wrote a bot using this library 4 days ago, it worked fine. Today, it just suddenly stopped working and I get "invalid_auth" when running it. Went to the Slack admin and apparently they are deprecating the auth token? I was able to create a "legacy" token that allowed the bot to connect, but after doing this, the bot does not respond to commands or operators.

Seems like Slack might be moving in the direction of forcing OAuth.

So the bot connects? Is it visibly online in Slack? It's possible that the legacy token isn't a bot token?

snex commented

Bot connects and is visibly online. The log output even scrolls by as I type in things, but the bot does not respond at all or even recognize anything as a command/operator.

Did you upgrade slack-ruby-bot and some behavior has changed? Has the bot loaded your commands? You should debug what happens in this code and walk the code to see why your command is not invoked.

snex commented

I have not upgraded at all, I started fresh on the latest version. Like I said, it worked fine a few days ago. Putting debug statements in that code yields no output at all.

Put the project up on Github and I can try to help.

I was able to reproduce this with a legacy token. This token is your user's token, so now the bot runs as you. That causes the code that prevents message loops to return true. It basically thinks that the bot is talking to itself, which is obviously a bad idea for humans.

Other users would not see this problem, or you can allow message loops as I did in snex/pokerstove_slack_bot#1. I also fixed your specs :) Hope this helps.

snex commented

Is this not still a problem that the normal bot token cannot connect at all?

I am not sure what "normal bot token" means, but that's a question for Slack (I don't work for Slack).