Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: OAuth2 in async DBs #29461

Merged
merged 2 commits into from
Jul 3, 2024
Merged

fix: OAuth2 in async DBs #29461

merged 2 commits into from
Jul 3, 2024

Conversation

betodealmeida
Copy link
Member

SUMMARY

When Superset triggers OAuth2 it needs to pass to the OAuth provider a redirect URL, to where the user will be sent with the initial OAuth2 code after granting access to Superset. This redirect URL is built using url_for, and needs to run in a Flask request context in order to have access to the application SERVER_NAME, in addition to PREFERRED_URL_SCHEME and APPLICATION_ROOT.

This PR modifies the get_sql_results Celery task to run the query under a dummy request context. This is enough for Superset to compute the redirect URL when the database is configured to run in async mode.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screenshot 2024-07-02 at 19-26-15 Superset

After:

Screenshot 2024-07-02 at 19-24-43 Superset

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added authentication Related to authentication global:async-query Related to Async Queries feature labels Jul 2, 2024
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@betodealmeida betodealmeida merged commit d5c0506 into master Jul 3, 2024
33 checks passed
eschutho pushed a commit that referenced this pull request Jul 24, 2024
@rusackas rusackas deleted the async-oauth2-refresh branch September 27, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Related to authentication global:async-query Related to Async Queries feature size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants