It’s not easy or obvious, but this code will delete a token:
from jupyterhub import orm
db_url = 'sqlite:///jupyterhub.sqlite'
token = '...'
db = orm.new_session_factory(url=db_url)()
orm_token = orm.APIToken.find(db, token)if orm_token is None:
print("No token matching %s" % token)else:
print("Removing %s" % orm_token)
db.delete(orm_token)
db.commit()
this script <https://gist.github.com/minrk/f27ff17f99c048c551fccaec49a44cea>
does the same thing with a CLI.
We should probably add it as a jupyterhub token drop entrypoint.
It is my hope to get some token management UI into JupyterHub 0.9, with
annotations for each token, e.g.
- note:”API token for randylai’s server”
- created: date
- last used: date
- user: name
where users and admins could audit and delete API tokens.
-MinRK
On Thu, Oct 5, 2017 at 6:17 PM, Randy Lai <[email protected]> wrote:
Maybe someone has asked before, I tried searching but found nothing.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/jupyter/0245c425-ecbb-4f0a-ac78-f724e9147d1b%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/0245c425-ecbb-4f0a-ac78-f724e9147d1b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/CAHNn8BWY4YHczQQ5uk9jcRc_5%3DmPh8E2jeyLmh2JRefdGO-LLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.