Open Alexander-Barth opened 2 years ago
We've tried to keep up with jupyterhub's poorly documented and ever changing arcana over the years, with obviously no success. Sorry.
For what it is worth I can create a notebook via curl by
curl -X POST -H "Content-Type: application/json" -H "Authorization: token $token" -d '{"type": "notebook"}' "$URL/user/abarth/api/contents"
But this is essentially what this functions is doing: https://github.com/millejoh/emacs-ipython-notebook/blob/388c8f753cfb99b4f82acbdff26bbe27189d2299/lisp/ein-notebooklist.el#L314
Maybe the error is triggered before.
So how could we help to solve this? I guess it's probably caused by passing an incorrect token value to the Header
, but I'm not very familiar with LISP.
Thanks for your efforts. Agree that documents of JupyterHub isn't well organized, LOL.
I had the same problem with getting error HTTP 403.
I somehow managed to hack a solution, but I don't seem able to fix the code:
(ein:query-singleton-ajax
(ein:url url-or-port "api/sessions")
:type "GET"
:params '(("token" . "<TOKEN>")) ; insert this line
:parser #'ein:json-read
:complete (apply-partially #'ein:content-query-sessions--complete url-or-port callback)
:success (apply-partially #'ein:content-query-sessions--success url-or-port callback)
:error (apply-partially #'ein:content-query-sessions--error url-or-port callback errback iteration)))
login to the server as normal; request.el
will create a cookie in emacs.d/curl-cookie-jar
with the correct token.
revert the code and you will be able to login as normal
After going through the code, I suspect that the token is not inserted into ein:query-authorization-tokens
, so when ein:query-prepare-header
is called the token is not included in the request.
This sort of problem only affected me when logging into Jupyterlab, previously when working with Jupyterhub that only had notebook support I did not face this issue.
Problem description
ein works very well on my machine with a local jupyter notebook session. However, when I am try to connect to a Jupyterhub instance using ein, I get a 403 error. I created a token via https://example.net/hub/token (without expiration). I verified that I can connect to the Jupyterhub instance without re-entering my password in a browser (in private mode without cookies) by following the link https://example.net/user/abarth/lab?token=32_digit_token (where example.net and 32_digit_token are my actual hostname and token)
Steps to reproduce the problem
There are the steps leading to the error:
I get the error message ein:notebooklist-new-notebook-error: error (error http 403)
I do indeed see a 403 "forbidden" error in the nginx server logs of the Jupyterhub instance.
At least, I can the filenames of the notebooks already present on the server (but I cannot execute them without having again 403 errors).
Maybe I missed some important steps, our jupyterhub server is not configured correctly or I did not use the right kind of token.
If somebody can point me in the right direction, this would be highly appreciated.
System info:
Logs:
ein:log-all: