Add GitHub Authentication
Execute the following to set up a method for students to sign in using GitHub.
From your GitHub account, navigate to the Developer Settings. Choose OAth Apps and create a New OAth app. Enter the corresponding information. Enter https://YOUR-URL/hub/oauth_callbackas the Authorization callback URL, being careful to replace YOUR-URL with the link to your lab.
On your Ubuntu server, install GitHub OAuth:
conda install -c conda-forge oauthenticator
Open the JupyterHub configuration file
nano /etc/jupyterhub/
Copy and paste the following into the file, being careful to replace the URL, Client ID, and Client Secret with your own. The Client ID and Client Secret can be found on the page of the GitHub "app" created above.
from oauthenticator.github import LocalGitHubOAuthenticator
c.JupyterHub.authenticator_class = LocalGitHubOAuthenticator
c.LocalGitHubOAuthenticator.oauth_callback_url = 'YOUR-URL/hub/oauth_callback'
c.LocalGitHubOAuthenticator.client_id = 'YOUR CLIENT ID'
c.LocalGitHubOAuthenticator.client_secret = 'YOUR CLIENT SECRET'
# This line means that it will no longer be necessary to manually add new users.
c.LocalGitHubOAuthenticator.create_system_users = True
It should look like this:
Notice that you may also change the admin username to your GitHub username to allow administrative access.
Use CTRL+O then enter to overwrite the document and CTRL+X to exit.
Reboot the server:
systemctl restart jupyterhub.service
Copy link