Hey everyone, looking for help from anyone that might have an idea of what’s going wrong. I am unable to authenticate at all, and as such am unable to really do anything else for the moment.
I am trying to connect to the SuiteCRM API via python and it seems that no matter how I try to request an access token I am always returned unsupported_grant_type. I have followed all the steps provided in the following documentation:
https://docs.suitecrm.com/developer/api/version-8/json-api/#_before_you_start_calling_endpoints
https://docs.suitecrm.com/developer/api/version-8/configure-authentication/
I have run composer, generated keys, changed the encryption key, I have created a Client Credentials entry in my installation of SuiteCRM and a Password Grant, and I am using the url and example provided in the second link above (but converted from PHP to Python). However, it doesn’t matter if I used client_credentials or password, I get the same error response from the API.
I should be able to send my client_id and client_secret and receive a JSON object containing my access_token.
This is the code I am using to try and get my access token:
import requests
url = 'https://mydomain.com/Api/access_token'
data = {
'grant_type': 'client_credentials',
'client_id': 'a4f0026f-7587-c416-4ae8-5d3796013a4e',
'client_secret': 'mysecretkey'
}
headers = {'Content-type': 'application/vnd.api+json', 'Accept': 'application/vnd.api+json'}
response = requests.post(url, data=data, headers=headers)
print(response.json())
and this is the response I get:
{'error': 'unsupported_grant_type', 'message': 'The authorization grant type is not supported by the authorization server.', 'hint': 'Check the
grant_typeparameter'}
This is the same response I get if I swap ‘grant_type’ to ‘password’ and add the credentials for my admin user.
My Environment
- SuiteCRM Version used: 7.10.17
- Environment name and version: PHP 7.2
- Operating System and version: Ubuntu 16.04 (both server and my computer)
- Python version: 3.6
If anyone has an idea of what’s going on help would be greatly appreciated!