You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/11/11 11:29:56 UTC

[GitHub] [superset] code23rus opened a new issue #17401: NameError: name 'AUTH_OAUTH' is not defined

code23rus opened a new issue #17401:
URL: https://github.com/apache/superset/issues/17401


   I want to set up OAuth2 authorization, but it not work.
   
   
   
   #### How to reproduce the bug
   
   1. Install superset according to the instructions: https://superset.apache.org/docs/installation/installing-superset-using-docker-compose
   2. According documentation https://superset.apache.org/docs/installation/configuring-superset add the lines to the end of the superset_config.py file:
   
   `AUTH_TYPE = AUTH_OAUTH
   OAUTH_PROVIDERS = [
       {   'name':'egaSSO',
           'token_key':'access_token', # Name of the token in the response of access_token_url
           'icon':'fa-address-card',   # Icon for the provider
           'remote_app': {
               'client_id':'myClientId',  # Client Id (Identify Superset application)
               'client_secret':'MySecret', # Secret for this Client Id (Identify Superset application)
               'client_kwargs':{
                   'scope': 'read'               # Scope for the Authorization
               },
               'access_token_method':'POST',    # HTTP Method to call access_token_url
               'access_token_params':{        # Additional parameters for calls to access_token_url
                   'client_id':'myClientId'
               },
               'access_token_headers':{    # Additional headers for calls to access_token_url
                   'Authorization': 'Basic Base64EncodedClientIdAndSecret'
               },
               'api_base_url':'https://myAuthorizationServer/oauth2AuthorizationServer/',
               'access_token_url':'https://myAuthorizationServer/oauth2AuthorizationServer/token',
               'authorize_url':'https://myAuthorizationServer/oauth2AuthorizationServer/authorize'
           }
       }
   ]
   
   # Will allow user self registration, allowing to create Flask users from Authorized User
   AUTH_USER_REGISTRATION = True
   
   # The default user self registration role
   AUTH_USER_REGISTRATION_ROLE = "Public"`
   
   3. Restart docker-compose containers
   4. See error
   
   `superset_app            | NameError: name 'AUTH_OAUTH' is not defined
   superset_app            | Failed to create app
   superset_app            | Traceback (most recent call last):
   superset_app            |   File "/app/superset/app.py", line 34, in create_app
   superset_app            |     app.config.from_object(config_module)
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/flask/config.py", line 174, in from_object
   superset_app            |     obj = import_string(obj)
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/werkzeug/utils.py", line 568, in import_string
   superset_app            |     __import__(import_name)
   superset_app            |   File "/app/superset/config.py", line 1303, in <module>
   superset_app            |     import superset_config  # pylint: disable=import-error
   superset_app            |   File "/app/docker/pythonpath_dev/superset_config.py", line 116, in <module>
   superset_app            |     AUTH_TYPE = AUTH_OAUTH
   superset_app            | NameError: name 'AUTH_OAUTH' is not defined
   superset_app            | [2021-11-11 09:58:28 +0000] [12] [ERROR] Exception in worker process
   superset_app            | Traceback (most recent call last):
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
   superset_app            |     worker.init_process()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
   superset_app            |     super().init_process()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
   superset_app            |     self.load_wsgi()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
   superset_app            |     self.wsgi = self.app.wsgi()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
   superset_app            |     self.callable = self.load()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
   superset_app            |     return self.load_wsgiapp()
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
   superset_app            |     return util.import_app(self.app_uri)
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 411, in import_app
   superset_app            |     app = app(*args, **kwargs)
   superset_app            |   File "/app/superset/app.py", line 44, in create_app
   superset_app            |     raise ex
   superset_app            |   File "/app/superset/app.py", line 34, in create_app
   superset_app            |     app.config.from_object(config_module)
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/flask/config.py", line 174, in from_object
   superset_app            |     obj = import_string(obj)
   superset_app            |   File "/usr/local/lib/python3.8/site-packages/werkzeug/utils.py", line 568, in import_string
   superset_app            |     __import__(import_name)
   superset_app            |   File "/app/superset/config.py", line 1303, in <module>
   superset_app            |     import superset_config  # pylint: disable=import-error
   superset_app            |   File "/app/docker/pythonpath_dev/superset_config.py", line 116, in <module>
   superset_app            |     AUTH_TYPE = AUTH_OAUTH
   superset_app            | NameError: name 'AUTH_OAUTH' is not defined
   superset_app            | [2021-11-11 09:58:28 +0000] [12] [INFO] Worker exiting (pid: 12)
   superset_app            | [2021-11-11 09:58:28 +0000] [10] [INFO] Shutting down: Master
   superset_app            | [2021-11-11 09:58:28 +0000] [10] [INFO] Reason: Worker failed to boot.`
   
   ### Expected results
   
   what you expected to happen.
   
   ### Actual results
   
   what actually happens.
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   ### Environment
   
   Environment latest, according latest docker-compose images.
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] code23rus closed issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
code23rus closed issue #17401:
URL: https://github.com/apache/superset/issues/17401


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] code23rus commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
code23rus commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-975202503


   Thank you very much for your help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] kamalkeshavani-aiinside commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
kamalkeshavani-aiinside commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-966746970


   You need to import `AUTH_OAUTH` in your config file.
   ```
   from flask_appbuilder.security.manager import AUTH_OAUTH
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] code23rus commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
code23rus commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-967043314


   Thanks for the answer. I added import but now another error:
   
   	Failed to create app
   	superset_worker         | Traceback (most recent call last):
   	superset_worker         |   File "/app/superset/app.py", line 37, in create_app
   	superset_worker         |     app_initializer.init_app()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 594, in init_app
   	superset_worker         |     self.init_app_in_ctx()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 557, in init_app_in_ctx
   	superset_worker         |     self.configure_fab()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 634, in configure_fab
   	superset_worker         |     appbuilder.init_app(self.superset_app, db.session)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/base.py", line 202, in init_app
   	superset_worker         |     self.sm = self.security_manager_class(self)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/sqla/manager.py", line 54, in __init__
   	superset_worker         |     super(SecurityManager, self).__init__(appbuilder)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/manager.py", line 257, in __init__
   	superset_worker         |     from authlib.integrations.flask_client import OAuth
   	superset_worker         | ModuleNotFoundError: No module named 'authlib'
   	superset_worker         | 2021-11-12 11:44:07,533:ERROR:superset.app:Failed to create app
   	superset_worker         | Traceback (most recent call last):
   	superset_worker         |   File "/app/superset/app.py", line 37, in create_app
   	superset_worker         |     app_initializer.init_app()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 594, in init_app
   	superset_worker         |     self.init_app_in_ctx()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 557, in init_app_in_ctx
   	superset_worker         |     self.configure_fab()
   	superset_worker         |   File "/app/superset/initialization/__init__.py", line 634, in configure_fab
   	superset_worker         |     appbuilder.init_app(self.superset_app, db.session)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/base.py", line 202, in init_app
   	superset_worker         |     self.sm = self.security_manager_class(self)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/sqla/manager.py", line 54, in __init__
   	superset_worker         |     super(SecurityManager, self).__init__(appbuilder)
   	superset_worker         |   File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/manager.py", line 257, in __init__
   	superset_worker         |     from authlib.integrations.flask_client import OAuth
   	superset_worker         | ModuleNotFoundError: No module named 'authlib'
   	superset_worker         | Error:
   	superset_worker         | Unable to load celery application.
   	superset_worker         | The module authlib was not found.
   	
   Also i installed authlib in superset container
   
   	docker-compose exec superset bash
   	pip install Authlib
   	
   but the error remained.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] aniaan commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
aniaan commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-974246091


   It seems that oauth and local can only choose one at present


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] code23rus commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
code23rus commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-974224761


   Thanks for the answer. 
   I seem to have configured authorization and my user is being created with the Gamma role.
   But now not work local authentication with user/password. 
   How can I make local authorization work too?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yunszhang commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
yunszhang commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-1002967633


   thanks very much


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] aniaan commented on issue #17401: NameError: name 'AUTH_OAUTH' is not defined

Posted by GitBox <gi...@apache.org>.
aniaan commented on issue #17401:
URL: https://github.com/apache/superset/issues/17401#issuecomment-971132605


   What you need is to `pip install authlib` when the container starts, not afterwards.
   You can do this,
   1.  `echo "Authlib" > ./docker/requirements-local.txt`
   2. start docker-compose
   
   https://github.com/apache/superset/blob/34d7f0a860caa254f45bec55dc893f8a5997b8cb/docker/docker-bootstrap.sh#L21-L37


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org