Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions docs/GITHUB.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
### GitHub authentication

- [Register a new OAuth application](https://github.com/settings/applications/new)
- "Homepage URL" should be the URL you access the frontend on (e.g. `http://localhost:8080`)
- "Authorization callback URL" should be the same as the homepage URL, but with `/login` appended
1. [Register a new OAuth application](https://github.com/settings/applications/new).

- Edit `.env.local`:
- Set `GITHUB_CLIENT_ID` to the application client ID
- Set `GITHUB_CLIENT_SECRET` to the application client secret (do **not** share this)
- Set **Homepage URL** to `http://localhost`.
- Set **Authorization callback URL** to `http://localhost/login`.
- If you have modified the nginx config, or are running the site on a different host or port, use that URL instead and append `/login` for the callback.

- Restart the server
2. Edit `backend/docker.dev.env`:

- Set `GITHUB_CLIENT_ID` to the OAuth application client ID.
- Set `GITHUB_CLIENT_SECRET` to the OAuth application client secret. Do not share this value.

3. Edit `.env`:

- Set `GITHUB_CLIENT_ID` to the OAuth application client ID. The frontend uses this to show the GitHub login button.
- You do not need to set `GITHUB_CLIENT_SECRET` here.

4. Restart the frontend and backend services so both environment files are reloaded.

### Making a user an admin

After signing in with GitHub, you can make yourself an admin with the following:
After signing in with GitHub, you can make your user an admin from the backend container:

```sh
docker compose exec backend uv run python manage.py shell
```
$ uv run python3 manage.py shell
>>> from django.contrib.auth.models import User
>>> user = User.objects.get(username="your_username")
>>> user.is_staff = True
>>> user.is_superuser = True
>>> user.save()

Then run:

```py
from django.contrib.auth.models import User

user = User.objects.get(username="your_github_username")
user.is_staff = True
user.is_superuser = True
user.save()
```

Then you can access the Django admin interface at `/admin`.
You can then access the Django admin interface at `/admin`.