Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not allowed token type for Slack connection #964

Closed
glazzara opened this issue Dec 21, 2019 · 22 comments
Closed

Not allowed token type for Slack connection #964

glazzara opened this issue Dec 21, 2019 · 22 comments
Labels
waiting for feedback Further information is requested

Comments

@glazzara
Copy link
Contributor

glazzara commented Dec 21, 2019

Describe the bug
I followed the creation of a bot token using : https://github.com/42wim/matterbridge/wiki/Slack-bot-setup

I got a xoxb token as expected however I cannot connect to Slack (via RTM) and it retries endlessly.

Expected behavior
Being connected to Slack.

Environment

  • Linux Debian
  • Matterbridge : matterbridge-1.16.3-linux-64bit

matterbridge.toml
[general]
RemoteNickFormat="[{LABEL}] @{NICK}"
TranslationAttribution=" [translated by :google:]"
PreserveThreading=true
ShowUserTyping=false
MediaDownloadSize=1000000
ShowJoinPart=false
NoSendJoinPart=false
IconURL="https://github.com/identicons/{NICK}.png"

[slack]
[slack.myslack]
Token="xoxb-TOKEN"
#RemoteNickFormat="{BRIDGE} - @{NICK}"
PrefixMessagesWithNick=true
Debug=true

[whatsapp.gui]
Number="XXXXXXXXX"
SessionFile="session-48111222333.gob"
RemoteNickFormat="[{PROTOCOL}] @{NICK}: "

[[gateway]]
name="gateway1"
enable=true

[[gateway.inout]]
account="whatsapp.gui"
channel="[email protected]"

[[gateway.inout]]
account="slack.myslack"
channel="test-whatsapp"

Debug output

[2019-12-21T16:41:09+01:00] INFO router: Starting bridge: slack.myslack
[2019-12-21T16:41:09+01:00] INFO slack: Connecting using token
[2019-12-21T16:41:09+01:00] INFO slack: slack.myslack: joining test-whatsapp (ID: test-whatsappslack.myslack)
nlopes/slack2019/12/21 16:41:09 websocket_managed_conn.go:177: Connecting to RTM
nlopes/slack2019/12/21 16:41:09 rtm.go:71: Using URL:
nlopes/slack2019/12/21 16:41:09 websocket_managed_conn.go:181: Failed to start or connect to RTM: not_allowed_token_type
nlopes/slack2019/12/21 16:41:09 websocket_managed_conn.go:147: reconnection 1 failed: not_allowed_token_type reconnecting in 100ms
[2019-12-21T16:41:09+01:00] ERROR slack: Connection failed "not_allowed_token_type" &errors.errorString{s:"not_allowed_token_type"}
[2019-12-21T16:41:09+01:00] INFO main: Gateway(s) started succesfully. Now relaying messages

@dvalfre
Copy link

dvalfre commented Dec 30, 2019

Similar issue is happening to me. Tried recreating the bot app and permission set on Slack, to no avail.
It will be useful if somebody out there with a working configuration can post the permissions the bot has on Slack.

@42wim
Copy link
Owner

42wim commented Dec 31, 2019

I just set-up a bot from scratch and it still works.
You are sure you have the bot scope there?

image

@42wim 42wim added the waiting for feedback Further information is requested label Dec 31, 2019
@glazzara
Copy link
Contributor Author

Hi,
Thanks for your tip !
I don't know why but when I created a new application, I got the right permissions and it worked ! In my previous app, I could see the 'bot' scope in bot oauth scopes even though I had created a bot.

@42wim
Copy link
Owner

42wim commented Dec 31, 2019

Ok, great news, going to close this now as I can't reproduce it and it works for you.

@42wim 42wim closed this as completed Dec 31, 2019
@McSneaky
Copy link

@42wim Where can you add bot scope? I have exactly the same problem and here's how it looks for me in Slack app settings:
image
As far as I understood adding some setting under "Bot Token Scopes" sets "bot" scope automatically. But trying to access Slack with following config:

[slack]
[slack.test]
Token="xoxb-XXX-XXX-XXX"
PrefixMessagesWithNick=true

[general]
RemoteNickFormat="[{PROTOCOL}/{BRIDGE}] <{NICK}> "

[[gateway]]
    name = "mygateway"
    enable=true

    [[gateway.inout]]
    account ="slack.test"
    channel = "bridge"

Throws error:

INFO main:         Running version 1.16.4-dev 4c44515f
INFO main:         WARNING: THIS IS A DEVELOPMENT VERSION. Things may break.
INFO router:       Parsing gateway mygateway
INFO router:       Starting bridge: slack.test 
INFO slack:        Connecting using token
INFO slack:        slack.test: joining bridge (ID: bridgeslack.test)
ERROR slack:       Connection failed "not_allowed_token_type" &errors.errorString{s:"not_allowed_token_type"}
ERROR slack:       Could not retrieve channels: &errors.errorString{s:"missing_scope"}
FATAL main:        Starting gateway failed: Bridge slack.test failed to join channel: could not join channel: &errors.errorString{s:"channel bridge not found"}

Interesting is that it gives not_allowed_token_type and missing_scope

In Slack channel exists and bot is present in there. Using Docker to run it

@frabrunelle
Copy link

I get the same error as @McSneaky. Also using Docker to run it. I tried adding additional token scopes but it didn't seem to make a difference.

@McSneaky
Copy link

Our team member finally got it to work. Not really 100% sure how, but here are some pointers what he found: slackapi/node-slack-sdk#921 (comment) and https://github.com/nlopes/slack/issues/654

Those might come handy for others too

@42wim
Copy link
Owner

42wim commented Feb 9, 2020

@McSneaky thanks for the feedback, also added in the https://github.com/42wim/matterbridge/wiki/Slack-bot-setup wiki

@ForsakenHarmony
Copy link

Seems like slack changed their permission model, which might require an update from the matterbridge side

@ForsakenHarmony
Copy link

ForsakenHarmony commented Feb 13, 2020

I've added some info that you have to create a CLASSIC slack app to the wiki

@42wim
Copy link
Owner

42wim commented Feb 14, 2020

@ForsakenHarmony thanks 👍

@Souptacular
Copy link

Souptacular commented Apr 2, 2020

Right now the regular Slack bot set-up won't work at all, only classic does.

Make a bot from scratch following the steps below.

I had to go through the following parts of the set-up in this order:

  1. https://github.com/42wim/matterbridge/wiki/Slack-bot-setup#create-the-classic-slack-app
  2. https://github.com/42wim/matterbridge/wiki/Slack-bot-setup#grant-scopes-and-install-the-slack-app
  3. https://github.com/42wim/matterbridge/wiki/Slack-bot-setup#invite-the-bot-to-channels-synced-with-matterbridge

DO NOT do the Legacy Setup steps.

You will be using an xoxb- once you are done.

@42wim
Copy link
Owner

42wim commented Apr 3, 2020

@Souptacular thanks for the feedback, I updated the wiki page about it.

@RobertDWhite
Copy link

RobertDWhite commented Apr 12, 2020

Followed the instructions above, and it kind of works? Getting the same error, but it is also saying the bridge started (config is correct).
time="2020-04-12T15:21:03Z" level=info msg="Gateway(s) started succesfully. Now relaying messages" prefix=main time="2020-04-12T15:21:03Z" level=error msg="Connection failed "not_allowed_token_type" &errors.errorString{s:"not_allowed_token_type"}" prefix=slack

Seems strange to me. I went through the steps multiple times with multiple new bots. U am using the "xoxb-" bot token.

@matticoli
Copy link

matticoli commented Apr 13, 2020

Seems strange to me. I went through the steps multiple times with multiple new bots. U am using the "xoxb-" bot token.
@robertomano24

I just went through the process myself and got the same error, it took me a few tries to figure it out. In step 2 of "Create the Classic Slack App" (linked in Souptacular's comment above make sure to use the provided link to create the app, and NOT the "Create App" button.

This seems to be the only way to create a legacy app, which will allow you to create a bot user and add the necessary scopes as described. Make sure not to click any of the "upgrade scopes" prompts during the process or it will break - the scopes in the new "granular permissions" system don't seem to work with matterbridge yet

@ForsakenHarmony
Copy link

made it caps and bold in the wiki

@htuscher
Copy link

htuscher commented Oct 5, 2021

I also get not_allowed_token_type despite having all the scopes configured correctly.
I'm trying to connect mattermost and slack.

Fun fact: the mattermost messages are posted to slack, but the slack messages can't be posted back to mattermost.
Only then the not_allowed_token_type occurs.

@muratgozel
Copy link

Hey, with the current implementation, the only to make this work is to create a Slack App through this link:
https://api.slack.com/apps?new_classic_app=1

@pge
Copy link

pge commented Jun 20, 2024

Hey guys! Sorry for the intrusion, but as of right now, classic apps are deprecated and there is no way to bridge to and from Slack.
Does anyone have a solution to this?

@chatagiri
Copy link

Hey guys! Sorry for the intrusion, but as of right now, classic apps are deprecated and there is no way to bridge to and from Slack. Does anyone have a solution to this?

I have same issue,
Shouldn't the issue be reopened since there is currently no way to deal with it?

@erkexzcx
Copy link

Slack integration is completely unusable right now...

@pm-radez
Copy link

Slack integration is completely unusable right now...

May i know when integration will be available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Further information is requested
Projects
None yet
Development

No branches or pull requests