jupyter / help

:sparkles: Need some help or have some questions? Please visit our Discourse page.
https://discourse.jupyter.org
291 stars 97 forks source link

Can @jupyterlab/services or the jupyter notebook API connect to a remote server using a password? #476

Open IanMatthewHuff opened 5 years ago

IanMatthewHuff commented 5 years ago

I'm currently using the SessionManager provided by @jupyterlab/services to connect from my application to a Jupyter instance running on a remote machine. Currently this works, but only using the basic token authentication connection. I'd like to also support connecting via a password, but I'm not seeing this as part of the API either for @jupyterlab/services or via the web API. Is there currently a way for a client to connect to a password protected remote jupyter server without having to hit the password login page via a webbrowser?

Here is the API we are using to make our connection currently: https://jupyterlab.github.io/jupyterlab/services/interfaces/serverconnection.isettings.html Has a place for a token, which we are using, but not seeing anything for a password.

minrk commented 5 years ago

password authentication is handled by submitting a form to $baseUrl/login and using the resulting cookie for submitting requests. I'm not certain this can be done via XHR. The notebook doesn't support http basic auth for passwords.

IanMatthewHuff commented 5 years ago

Thanks much for the reply @minrk. That lines up with what I was seeing searching around the net, but it's nice to have it confirmed. We'll just use the token for now and I'll take a poke at seeing if I can submit the form via a request and juggle the cookie myself. Not sure if that will work, but might be worth a try.

minrk commented 5 years ago

supporting http basic auth headers on all requests is also something we can add to the notebook server, which would mean that setting the Authorization header would be all you need from services.

IanMatthewHuff commented 5 years ago

@minrk Sorry about re-bumping this old thread, but I was pull away by some other work after the holidays. If we wanted to put in a request for supporting http basic auth headers where should I log that? I'm not exactly sure how the git repros are broken down.

Possibly here? https://github.com/jupyterlab/jupyterlab/issues?utf8=%E2%9C%93&q=is:open+is:issue

Not sure if this would be part of the main notebook or the @jupyterlab/services ServerConnection.

jasongrout commented 5 years ago

It sounds like the first thing to do is add support in the notebook server: https://github.com/jupyter/notebook (and perhaps to the nascent jupyter server package: https://github.com/jupyter/jupyter_server)

Once it's added to the notebook server, then would be the time to add it to the jlab services package.