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

Superset-cli does not work with OAUTH configured #307

Open
editicalu opened this issue Jun 27, 2024 · 0 comments
Open

Superset-cli does not work with OAUTH configured #307

editicalu opened this issue Jun 27, 2024 · 0 comments

Comments

@editicalu
Copy link

I have a superset instance running SSO (configuration is done using the official Helm Chart), but I cannot get the export-roles to work. The error I get:

Traceback (most recent call last):
  File "/Users/wards/git/superset/scripts/.venv/bin/superset-cli", line 8, in <module>
    sys.exit(superset_cli())
             ^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/preset_cli/cli/superset/export.py", line 257, in export_roles
    yaml.dump(list(client.export_roles()), output)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/preset_cli/api/clients/superset.py", line 841, in export_roles
    user_email_map = {user["id"]: user["email"] for user in self.export_users()}
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/preset_cli/api/clients/superset.py", line 841, in <dictcomp>
    user_email_map = {user["id"]: user["email"] for user in self.export_users()}
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wards/git/superset/scripts/.venv/lib/python3.11/site-packages/preset_cli/api/clients/superset.py", line 821, in _export_users_superset
    table = soup.find_all("table")[1]
            ~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

After some investigation, it turns out this is because the List users page returns a sign in page to our SSO. When using superset-cli to export databases and datasets, this doesn't pose a problem (because the admin credentials are still valid on the API), however sign-in to view the CRUD page for users doesn't work.

Possible Resolution

When activating FAB_ADD_SECURITY_API = True in superset_config.py, you can get the active roles from the security API:
https://<superset>/api/v1/security/roles/

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

No branches or pull requests

1 participant