Skip to content

Use API authentication instead of token scraping#379

Open
joaopamaral wants to merge 13 commits intopreset-io:mainfrom
Automattic:make-auth-through-api
Open

Use API authentication instead of token scraping#379
joaopamaral wants to merge 13 commits intopreset-io:mainfrom
Automattic:make-auth-through-api

Conversation

@joaopamaral
Copy link

@joaopamaral joaopamaral commented Feb 26, 2026

Replace the HTML-scraping-based authentication with Superset's official security API endpoints.

Previously, UsernamePasswordAuth authenticated by:

  1. Fetching /login/ and scraping the CSRF token from the HTML using BeautifulSoup
  2. POSTing credentials to /login/ as form data

This was fragile and dependent on Superset's frontend HTML structure. The new approach uses the documented REST API:

  1. POST /api/v1/security/login → obtains a JWT access token
  2. GET /api/v1/security/csrf_token/ → obtains a CSRF token using the Bearer token

It was initially proposed in #319 (but I forgot to address the comments, sorry @Vitor-Avila)

@joaopamaral joaopamaral marked this pull request as ready for review February 26, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants