Python-slack-sdk: Cannot combine AUTHORIZATION header with AUTH argument or credentials encoded in URL

Created on 18 Nov 2019  路  2Comments  路  Source: slackapi/python-slack-sdk

Description

After upgrading 2.3.1 we started getting "Cannot combine AUTHORIZATION header with AUTH argument or credentials encoded in URL" errors

What type of issue is this? (place an x in one of the [ ])

  • [ X] bug

Requirements (place an x in each of the [ ])

  • [X ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [ X] I've read and agree to the Code of Conduct.
  • [ X] 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: 2.3.1

python version: 3.7.4

OS version(s): OSx 19.0.0

Steps to reproduce:

Run the following code:

client = slack.WebClient(token=SLACK_TOKEN)

    # Request the auth tokens from Slack
    try:
        response = client.oauth_access(
            client_id=CLIENT_ID, client_secret=CLIENT_SECRET, code=auth_code
        )
...

Expected result:

Success

Actual result:

Failure

File "/var/task/slack/web/client.py", line 1131, in oauth_access
    auth={"client_id": client_id, "client_secret": client_secret},
  File "/var/task/slack/web/base_client.py", line 172, in api_call
    return self._event_loop.run_until_complete(future)
  File "/var/lang/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
    return future.result()
  File "/var/task/slack/web/base_client.py", line 229, in _send
    http_verb=http_verb, api_url=api_url, req_args=req_args
  File "/var/task/slack/web/base_client.py", line 259, in _request
    async with session.request(http_verb, api_url, **req_args) as res:
  File "/opt/python/aiohttp/client.py", line 1005, in __aenter__
    self._resp = await self._coro
  File "/opt/python/aiohttp/client.py", line 433, in _request
    raise ValueError("Cannot combine AUTHORIZATION header "
2x question web-client

Most helpful comment

client = slack.WebClient(token=SLACK_TOKEN)

For oauth.access API calls, you should not give an access token when initializing the client. The purpose to call oauth.access API is to acquire a valid access token.

As this document shows, giving an empty string as below works.

client = slack.WebClient(token="")

All 2 comments

client = slack.WebClient(token=SLACK_TOKEN)

For oauth.access API calls, you should not give an access token when initializing the client. The purpose to call oauth.access API is to acquire a valid access token.

As this document shows, giving an empty string as below works.

client = slack.WebClient(token="")

As I've already answered this question, allow me to close this issue now.

Was this page helpful?
0 / 5 - 0 ratings