Issue with Obtaining JSON Access Token Using API Key in Cribl
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 requests client_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!
Comments
-
You can see a sample of login process in
Hopefully it will help you get started.
0 -
Hi, @Jon Rust thank you!
I successfully built my access token and used it. Do you know if I can use it to retrieve logs from the data lake I created (the destination data)?
Also, does having a free account limit any of the available API functionalities?
0