Problem in getting Access Token

On requesting access token, the api returns:

{"status":"Bad Request","result":{"errors":[{"message":"Client id not received with the request. Check API documentation and content type of your request","code":"Bad Request"}]}}

I am using the following code to request access token:

headers = {'content-Type': 'application/json',}
data = {'grant\_type': 'authorization\_code', 'code': authorization\_code, 'client\_id': client\_id, 'client\_secret': client\_secret, 'redirect\_uri': callback\_uri}
access\_token\_response ='', headers=headers, data=data)

with appropriate values in place of authorization_code, client_id and client_secret, and callback_uri = “

1 Like

The last line of your code should be:

access\_token\_response ='', data=json.dumps(data), headers=headers)

data is a Python object and you must convert it into a JSON formatted string using json.dumps()