# 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_callback`**&#x61;s the Authorization callback URL, being careful to replace YOUR-URL with the link to your lab.

![](/files/-MDGhfZWyfpmEsLZop4S)

On your Ubuntu server, install GitHub OAuth:

```
conda install -c conda-forge oauthenticator
```

Open the JupyterHub configuration file

```
nano /etc/jupyterhub/jupyterhub_config.py
```

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
c.LocalGitHubOAuthenticator.allow_all = True
```

It should look like this:

![](/files/-MDGkGsaY4QAJJDgzUvX)

{% hint style="info" %}
Notice that you may also change the admin username to your GitHub username to allow administrative access.
{% endhint %}

Use CTRL+O then enter to overwrite the document and CTRL+X to exit.

Reboot the server:

```
systemctl restart jupyterhub.service
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-jupyter.davidjachochavez.org/optional-github-authentication/add-github-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
