Hi,
I'm working on code that uses an API key to access my data in Cribl. I started by creating API credentials (client_id
and client_secret
) and built a simple script to obtain an access token, which I plan to use for querying logs.
Here’s the code I wrote:
import requestsclient_id = 'XXX'
client_secret = 'XXX'
auth_url = 'https://XXX.cribl.cloud/api/v1/auth/token'
payload = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
'audience': 'https://api.cribl.cloud'
}
headers = {
'Content-Type': 'application/json'
}response = requests.post(auth_url, data=payload, headers=headers)
When I run this, I receive a 200
response, but the content is not in JSON format. Instead, the content is:
you need to enable JavaScript to run this app.
It seems to be returning the web application HTML rather than a JSON response with an access token. My goal is to use this token in a query to fetch logs.
Could you please help me understand why the token request is returning HTML instead of JSON, and how to correctly obtain the access token?
Thank you!