Can i extend the Jupyterhub hub's API ? Or should i make a new API service and add it as a service to jupyterhub?

So i have a requirement to provision short live tokens to usernotebook. The notebook server will be having encrypted refresh token. The user notebook will provide the encrypted refresh token and the current access token to the hub and hub will return new access token with encrypted token back to the user.
I was planning to have a API call to hub but i cant seem to find a good example on how i can extend the existing hub API. It would be really helpful if someone can point me to it. Or if making my own api service is better option then do let me know.

The best way to extend the JupyterHub API is by writing a service:

Your service can be standalone, or managed by JupyterHub, and you can either give it an API token to interact with JupyterHub (for example the idle culler does this since it’s not directly associated with a user), or you can use JupyterHub’s internal OAuth to obtain a token that’s associated with the logged in user.

3 Likes