feat(nbviewer): add OAuth2 support for jupyterhub > 3.4#1065
feat(nbviewer): add OAuth2 support for jupyterhub > 3.4#1065Schum-io wants to merge 4 commits intojupyter:mainfrom
Conversation
|
I'm trying to bring nbviewer back into a good state, and this is my next stop. Since it's been so long, I'm not going to ask you to respond to review suggestions after a full year of silence, but I'm going to a make a few edits in-place because I think this is almost there, but needs to check for access scopes. I'm going to try to get to it this week. Let me know if you'd rather get a review and make updates yourself, or if you'd rather I continue in a separate PR, otherwise I'll update and merge here myself without expecting you to respond promptly when we haven't done that at all for you. A belated thank you for the PR! |
Hi! Feel free to edit and merge directly — I've moved to a different team and don't actively use nbviewer anymore. That said, our company still uses my fork, so if the changes make it upstream, that's great. Thanks for keeping the project alive! |
nbviewer Integration with JupyterHub via OAuth2
This guide explains how to configure nbviewer as a JupyterHub service using OAuth2 token-based authentication.
Requirements
JupyterHub Configuration
In JupyterHub’s
jupyterhub_config.py, add the following configuration to integrate nbviewer as a service:Explanation of Key Settings:
nbviewer Configuration
In the deployment of nbviewer, configure the following environment variables:
Explanation of Environment Variables:
OAuth2 Flow
When a user accesses nbviewer, they will be authenticated via the OAuth2 token from JupyterHub. The oauth_callback URL specified in the configuration will be used to handle the token exchange.
Ensure nbviewer correctly handles OAuth2 requests by ensuring the callback URL is properly set and that nbviewer is able to request the necessary scopes from JupyterHub.
Troubleshooting
If you encounter issues with token authentication or authorization, ensure that:
The correct API token is set both in JupyterHub and nbviewer.
The service roles and scopes are correctly configured to allow nbviewer access to JupyterHub's user data.