You need to specify the JupyterHub username that the token should correspond to. The default is whoami, but that only works if your current shell user is the user you mean to be giving API access. If you run
jupyterhub token kaylee
it will give you a token for API access as kaylee.
-MinRK
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAFub%3DKTRt_PQ-ZvNybkA%3DmivRuXnS-vuvEqSTPGKDaQzjp7HYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Ah, I see now. With current JupyterHub, the user has to be in the db before you can run jupyterhub token. If you are not using a whitelist, this means that you must have logged in at least once. I will fix this for the next release. In the meantime, JupyterHub 0.6 makes it so you don’t need to deal with jupyterhub token at all, because you can generate tokens however you like, e.g.
openssl rand -hex 32
And load them into JupyterHub via config:
c.JupyterHub.api_tokens = { 'username': 'token' }`
-MinRK
--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAFub%3DKTePQ5nVMRaxPEEYv%2BBo7Aunxyv50AjZXKzGFfbr3YP-Q%40mail.gmail.com.
On Tue, May 3, 2016 at 11:07 AM, Ozan Çağlayan <oza...@gmail.com> wrote:
Hi,Okay I struggled for an hour after to find that the key->value in api_tokens is 'token' : 'username' not 'username': 'token' :)) Then the hub failed to start because it added a token as a username. I deleted some stuff from the sqlite database and now it seems OK :)
Sorry about having that backwards!
Can I run this cull_idle_servers as root? I don't really get how the hub matches the token against the username?
You can run the script as any user, including nobody. When an API request is made to the Hub, a token is used to identify the user making the request. This is always the user according to the Hub, which may or may not have any relationship to the unix users on the system. The token alone identifies the permissions the script has in terms of actions it can take with the Hub (listing users, shutting down servers). The only requirement is that it is an admin user in the hub.
-MinRK
--Thanks!
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAFub%3DKSHqOCUyFzqNuXs8H1xtWta-QvW2NjrHcv%2BUPgULVorzQ%40mail.gmail.com.
Hi,
Just a quick general question about cull-idle-servers. When I launch the script with the token of a user who has also open notebooks, they get never culled and the last active time gets apparently updated by a cull idle frequency. I thought that the last active time is only affected by some actions on an open notebook through the web interface, am I wrong?