python-slack-sdk: 'error': 'invalid_auth'
Description
Do all like in documentation and set real token(it works in another apps), but getting ‘error’: ‘invalid_auth’ In another app i’m set not only token and channel, but and “Team Subdomain” too. May be i need set it here? How can i do this?
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
slackclient version: 1.1.3
python version: 3.4.2
OS version(s): Debian 8
Steps to reproduce:
- Set env variable SLACK_API_TOKEN with real token and run ipython3
- import os and slackclient
- slack_token = os.environ[“SLACK_API_TOKEN”]
- sc = SlackClient(slack_token)
- sc.api_call(“channels.list”)
- boom
{'ok': False,
'headers': {'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload',
'Content-Length': '55',
'X-Via': 'haproxy-www-axyi',
'X-Slack-Req-Id': 'e3f810..................184314',
'Referrer-Policy': 'no-referrer',
'Server': 'Apache',
'Via': '1.1 e7c51f66...........3bf97c.cloudfront.net (CloudFront)',
'X-Slack-Backend': 'h',
'X-XSS-Protection': '0',
'Content-Type': 'application/json; charset=utf-8',
'X-Content-Type-Options': 'nosniff',
'Connection': 'keep-alive',
'Date': 'Wed, 14 Mar 2018 16:49:58 GMT',
'Access-Control-Allow-Origin': '*',
'Vary': 'Accept-Encoding',
'X-Cache': 'Miss from cloudfront',
'X-Amz-Cf-Id': 'vosAE.........g==',
'Content-Encoding': 'gzip'},
'error': 'invalid_auth'}
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
@nrukavkov I got this issue fixed. You need to send
Authorization token
inside headers. Earlier we were passing the token along with the query params but according to the latest documentation on slack, now we need to send it in headers only.nvm, after removing the token from parameters and move it to authorization header, i got it working!!! Thanks @nrukavkov
My python code looks like
@Roach I’m getting access tokens with these prefixes
xoxp
andxoxb
.Still I am getting:
{"ok":false,"error":"invalid_auth"}
Ah, sounds like a
verification
token, rather than abot
token.Go to your app’s setting page, then go to Install App and copy the Bot User OAuth Access Token from there
More on our token types: https://api.slack.com/docs/token-types
Thanks a lot!. My token was wrong!