nteract / hydrogen

:atom: Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
https://nteract.gitbooks.io/hydrogen/
MIT License
3.92k stars 334 forks source link

api tokens and jupyterhub #1462

Open benzipperer opened 5 years ago

benzipperer commented 5 years ago

Hi, I am trying to use Atom+Hydrogen to start notebooks through a jupyterhub server. Has anyone had success generating API tokens and using them to start a single-user notebook server through jupyterhub?

Once jupyterhub-singleruser is already running -- because USERNAME has logged into http://SERVER:8000 -- hydrogen seems to connect fine with configuration

[{ "name": "SERVER", "options":{"baseUrl":"http://SERVER:8000/user/USERNAME", "token": "APITOKEN"}}]

However, without logging in to the above website to start the user's server, Hydrogen complains that the connection to gateway failed. I was hoping to use API token in atom without having to log in via the above website. Is that possible?

I was hoping that adding API tokens to c.JupyterHub.api_tokens={} in the jupyterhub_config.py file would suffice, but that doesn't seem to help.

kylebarron commented 5 years ago

There's a bit of conversation about using it with JupyterHub here: https://github.com/nteract/hydrogen/issues/1274

benzipperer commented 5 years ago

Thanks! Yes, that thread does correctly identify that you need a baseUrl of http://SERVER:8000/user/USERNAME rather than just http://SERVER:8000/.

I'm unsure but I think what I am struggling with is how to start jupyterhub-singleuser when necessary through Hydrogen or at least have this somehow start without having the user additionally log in through http://SERVER:8000/.

After the jupyterhub-singleuser process is running for a given user (say because of the web login) hydrogen connects just fine. But after jupyterhub is restarted, say after a reboot, the user must use the web login before connecting with hydrogen, which I'd like to try to avoid.

wadethestealth commented 4 years ago

A great idea for the plugin api would be to create pipelines for starting, interrupting, restarting, and shutting down kernels. This way you can be directed on start to the web auth by automatically opening a remote electron window, or if you wish the users default browser.

Hoeze commented 4 years ago

Is this usable with multiple users and LDAP authentication? We do have a jupyterhub instance with LDAP authentication + slurm spawners. It would be fine to spawn servers manually, but having access to every other person's jupyterhub-singleuser instances would be a no-go.