Error: Grant type is not set while trying to generate the Token

Viewed 13

I am working on a python script that generates the access token. I am working on API calls for the first time. I am getting the below error: jsonResponse: { 'error_description': 'Grant type is not set', 'error': 'invalid_request' } I tried all the different grant_types but getting the same error. Could someone help me?

import requests

import json

myToken = 'https://......../internal/access_token'

headers =      
   {

                    "Accept": "application/json",
                    'Authorization': 'Bearer {}'.format(myToken),
                   "Content-Type": "application/x-www-form-urlencoded",
                   "Grant_Type":"client_credentials",
                    "scope": 'api-customer',
                    "client_id": '<Clientid>',
                    "client_secret": '<secret>'
  }

response = requests.post(myToken, headers = headers)

jsonResponse = response.json()

print('jsonResponse: ' + str(jsonResponse))

Thanks

0 Answers
Related