After upgrading 2.3.1 we started getting "Cannot combine AUTHORIZATION header with AUTH argument or credentials encoded in URL" errors
x in one of the [ ])x in each of the [ ])Filling out the following details about bugs will help us solve your issue sooner.
slackclient version: 2.3.1
python version: 3.7.4
OS version(s): OSx 19.0.0
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
)
...
Success
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 "
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.
Most helpful comment
For
oauth.accessAPI calls, you should not give an access token when initializing the client. The purpose to calloauth.accessAPI is to acquire a valid access token.As this document shows, giving an empty string as below works.