the-littlest-jupyterhub: Can't get NativeAuthenticator to work

From a default install which worked fine, I did

sudo tljh-config set auth.type nativeauthenticator.NativeAuthenticator
sudo tljh-config reload

That didn’t work (could not log in as admin anymore, and there was no difference in the login screen). The log obtained with journalctl -u jupyterhub does not show anything when attempting to log in.

Lacking logs, I also tried

git clone https://github.com/jupyterhub/nativeauthenticator.git
cd nativeauthenticator
pip install -e .

as instructed at https://native-authenticator.readthedocs.io/en/latest/quickstart.html (in the hope that my install did not work because I simply did not have nativeauthenticator yet). That did not work either, unfortunately.

Any pointers? What is the correct procedure, and how can I get some more logging info out of tljh so I can debug things like this in the future myself? Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

Adding the file /opt/tljh/config/jupyterhub_config.d/native_auth.py allowed me to sign up with admin user admin.

cat /opt/tljh/config/jupyterhub_config.d/native_auth.py 
c.JupyterHub.authenticator_class = 'nativeauthenticator.NativeAuthenticator'
c.Authenticator.admin_users = {'admin'}

To understand why this works I found the following link very helpful: https://tljh.jupyter.org/en/latest/topic/escape-hatch.html#extending-jupyterhub-config-py btw I didn’t have to install NativeAuthenticator separately.

Thanks for providing tljh!

@RobinTTY admins must create their accounts if you didn’t import it from the FirstUseAuthenticator as you can see here: https://github.com/jupyterhub/nativeauthenticator/blob/2fede2bfc109c9107064eb4a7c48dd4e4d6a79ee/nativeauthenticator/nativeauthenticator.py#L236.

The admin definitions are being absorbed from the jupyter_config.py file, as defined here: https://github.com/jupyterhub/nativeauthenticator/blob/2fede2bfc109c9107064eb4a7c48dd4e4d6a79ee/nativeauthenticator/nativeauthenticator.py#L183.

Also, I would recommend get the last version from the Github not pypi because I didn’t updated it yet

Sorry for my absence. Will take a look later today

Is there any update on this? Had the exact same problem when trying to switch to NativeAuthenticator and couldn’t find a method to get around it. The authenticator works great but I have no more admin user I’m able to login with to approve the users after activating it.

Also as mentioned before setting auth.NativeAuthenticator.import_from_firstuse doesn’t work and only results in the error import_from_firstuse not recognized by NativeAuthenticator appearing in the logs.

Is there maybe a method to create a new admin user using the console for NativeAuthenticator? Had no luck with the regular sudo tljh-config add-item users.admin <username> command.

Edit: Actually it seems like I can just register the admin account through the signup page and have access again. The documentation for NativeAuthenticator actually states “It is important to notice that admin must also create a new user through signup.”, so if this is expected behavior it is a little confusing to say the least 😛

This is something I am fixing for the next version (login will have a link for signup). To check if you are using Native Auth you can go to /hub/signup to see if it is working 😃