jupyterhub / oauthenticator

OAuth + JupyterHub Authenticator = OAuthenticator
https://oauthenticator.readthedocs.io
BSD 3-Clause "New" or "Revised" License
410 stars 364 forks source link

Using Auth0 subdomain without using ENV variables #205

Closed JuanCab closed 6 years ago

JuanCab commented 6 years ago

I am trying to use the oauthenticator plugin in TLJH which allows you to set variables but has no clear mechanism for defining environmental variables for the instance of JupyterHub. From reviewing the source code for the Auth0 authenticator at

https://github.com/jupyterhub/oauthenticator/blob/master/oauthenticator/auth0.py

it seems that the only way to set the Auth0 subdomain value to use is via an environmental variable AUTH0_SUBDOMAIN. Is there no other mechanism to do this via jupyterhub_config.py?

minrk commented 6 years ago

Indeed, this (and all other env-only config, which is ~only setting provider URLs, I think) should be settable via a regular traitlet. They are not currently due to an implementation detail that these particular values are configured prior to when traitlets get a chance to intervene, due to the mixin API we started out with. But that's a solvable problem.

In the meantime, you can always set environment variables in jupyterhub_config.py:

import os
os.environ['AUTH0_SUBDOMAIN'] = 'mysubdomain'

That's AOK, and I wouldn't even describe it as a workaround. It's a totally valid thing to do.

JuanCab commented 6 years ago

OK, took a while, but that will work for me.