Dataset API returns empty results ([]) despite user owning datasets (Superset 6.1.0rc1) #39520
Replies: 1 comment
-
|
Hi @hallebanis! I'm Dosu and I’m helping the superset team. @hallebanis This is a frequently reported issue — the Dataset API returns empty results because Bearer tokens alone don't establish the session cookies that Superset's authorization filters require. The token authenticates you (hence the 200 OK), but the The fix is to use a import requests
session = requests.Session()
# 1. Login
login_resp = session.post(
"http://localhost:8088/api/v1/security/login",
json={"username": "admin", "password": "admin", "provider": "db"}
)
access_token = login_resp.json()["access_token"]
# 2. Get CSRF token (this establishes the session cookie)
session.headers.update({"Authorization": f"Bearer {access_token}"})
csrf_resp = session.get("http://localhost:8088/api/v1/security/csrf_token/")
csrf_token = csrf_resp.json()["result"]
session.headers.update({"X-CSRFToken": csrf_token})
# 3. Now API calls will return results
resp = session.get("http://localhost:8088/api/v1/dataset/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)")
print(resp.json())Key points:
Regarding the To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When calling the Superset Dataset API (/api/v1/dataset/) using a Bearer token, the response returns 200 OK with an empty result set (result: []), even though the authenticated user is the owner of existing datasets.
The same user can see the datasets correctly in the Superset UI.
Steps to Reproduce
Authenticate using a Bearer token
Call the dataset API:
GET /api/v1/dataset/?q=(order_column:changed_on_delta_humanized,order_direction:desc,page:0,page_size:25)
Authorization: Bearer
Observe the response
Actual Result
{
"result": []
}
Expected Result
Datasets owned by the authenticated user should be returned, consistent with what is visible in the UI.
Logs
Environment
Superset version: 6.1.0rc1
Deployment: Docker
Authentication method: Bearer token
Beta Was this translation helpful? Give feedback.
All reactions