{"id":23143684,"url":"https://github.com/digitalinteraction/netlify-cms-github-auth","last_synced_at":"2025-08-17T14:33:47.945Z","repository":{"id":39574883,"uuid":"368225948","full_name":"digitalinteraction/netlify-cms-github-auth","owner":"digitalinteraction","description":"A backend to allow GitHub logins for a self hosted netlify-cms","archived":false,"fork":false,"pushed_at":"2023-02-01T00:00:56.000Z","size":809,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-03-23T13:01:10.320Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalinteraction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-17T14:59:51.000Z","updated_at":"2022-03-02T19:55:09.000Z","dependencies_parsed_at":"2023-02-17T00:05:18.435Z","dependency_job_id":null,"html_url":"https://github.com/digitalinteraction/netlify-cms-github-auth","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fnetlify-cms-github-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fnetlify-cms-github-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fnetlify-cms-github-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalinteraction%2Fnetlify-cms-github-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalinteraction","download_url":"https://codeload.github.com/digitalinteraction/netlify-cms-github-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230136101,"owners_count":18178814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T15:14:00.231Z","updated_at":"2024-12-17T15:14:00.874Z","avatar_url":"https://github.com/digitalinteraction.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netlify-cms-github-auth\n\nA backend to allow GitHub logins for a self hosted netlify-cms.\n\n## About\n\nThis project produces a container that you can use as a backend for\n[netlify-cms](https://www.netlifycms.org)\nso that you can authenticate with GitHub via OAuth2.\nThe container wraps the logic from\n[digitalinteraction/vercel-netlify-cms-github](https://github.com/digitalinteraction/vercel-netlify-cms-github)\ninto a http server to serve requests and a health check.\nThe app itself is minimal and only relies on\n[@openlab/vercel-netlify-cms-github](https://github.com/digitalinteraction/vercel-netlify-cms-github),\n[debug](https://github.com/visionmedia/debug), and\n[simple-oauth2](https://github.com/lelylan/simple-oauth2).\n\n## Guide\n\nThis guide follows a deployment where the auth container is at `https://example.com`.\n\n**1. Create a GitHub OAuth application**\n\nGo to https://github.com/settings/developers.\n\n- Set **Homepage URL** to your static website url\n- Set **Authorization callback URL** to `https://example.com/callback`\n- Make a note of your `client_id` and `client_secret`\n\n**2. Deploy your container**\n\nThere are so many ways to deploy containers, so this guide won't go into specifics.\nYou want the container to be publicly available,\nprobably behind a reverse proxy with an SSL certificate.\nThe app runs on port `3000`\nand you will need to set the required environment variables from below.\n\n[You can find the container here →](https://github.com/orgs/digitalinteraction/packages/container/package/netlify-cms-github-auth)\n\n**3. Configure netlify-cms**\n\nUpdate your `config.yml`'s backend:\n\n```yaml\nbackend:\n  name: github\n  repo: example/repository\n  base_url: https://example.com\n  auth_endpoint: auth\n```\n\nwhere:\n\n- `repo` is the GitHub repository path with the owner in it\n- `base_url` is the url to your server\n  This must not have any path components in, see _path-based routing_ below\n- `auth_endpoint` is the endpoint netlify-cms talks to (set to `auth`)\n\n[More information about netlify-cms backends →](https://www.netlifycms.org/docs/backends-overview/)\n\n\u003e For path-based routing, for instance where your container is accessible at\n\u003e `https://example.com/api/`,\n\u003e set `base_url` to `https://example.com`\n\u003e and `auth_endpoint` to `api/auth`.\n\u003e\n\u003e The `auth` on the end is the endpoint inside the container netlify-cms needs to talk to\n\u003e and `api` at the start is your path to the container.\n\u003e\n\u003e Make sure this aligns with **Authorization callback URL** from step 1.\n\n### Environment variables\n\n**Required**\n\n- `SELF_URL` - The public url where the container is accessible at with no trailing slashes\n- `OAUTH_CLIENT_ID` - Your GitHub OAuth2 client id\n- `OAUTH_CLIENT_SECRET` - Your GitHub OAuth2 client secret\n\n**Optional**\n\nYou could use these to talk to an enterprise version of GitHub,\nbut this hasn't been tested.\n\n- `OAUTH_HOST` (default: `https://github.com`)\n- `OAUTH_TOKEN_PATH` (default: `/login/oauth/access_token`)\n- `OAUTH_AUTHORIZE_PATH` (default: `/login/oauth/authorize`)\n\n### Health check endpoint\n\nThe app has an endpoint at `/healthz` which you can use for checking the container's health.\nCurrently, it will return a `200` if everything is ok\nor a `503` if the app is terminating.\n\n### High-availability\n\nThe app is stateless so you can run multiple instances if you'd like.\nIn production, the app will wait an extra 5 seconds before shutting down\nwhile failing the health check to allow load balancers to update\nand connections to terminate.\n\n[More info →](https://github.com/godaddy/terminus#how-to-set-terminus-up-with-kubernetes)\n\n## Development\n\n### Setup\n\nTo develop on this repo you will need to have [Docker](https://www.docker.com/) and\n[node.js](https://nodejs.org) installed on your development machineand have an understanding of them.\nThis guide assumes you have the repo checked out and are on macOS/unix based system.\n\nYou'll only need to follow this setup once for your development machine.\n\n```bash\n# cd to/this/folder\n\n# Install NPM dependencies\nnpm ci\n```\n\n### Regular use\n\nThese are the commands you'll regularly run to develop on this repo, in no particular order.\n\n```bash\n# cd to/this/folder\n\n# ...\n```\n\n### Testing\n\nThis repo uses automated tests to ensure that everything is working correctly, avoid bad code and reduce defects.\n[Jest](https://www.npmjs.com/package/jest) is used to run these tests.\nTests are any file in `src/` that end with `.spec.ts`, by convention they are inline with the source code,\nin a parallel folder called `__tests__`.\n\n```bash\n# cd to/this/folder\n\n# Run the tests\nnpm test -s\n\n# Generate code coverage\nnpm run coverage -s\n```\n\n### Irregular use\n\nThese are commands you might need to run but probably won't, also in no particular order.\n\n```bash\n# cd to/this/folder\n\n# ...\n```\n\n### Code formatting\n\nThis repo uses [Prettier](https://prettier.io/) to automatically format code.\nIt works using [yorkie](https://www.npmjs.com/package/yorkie)\nand [lint-staged](https://www.npmjs.com/package/lint-staged) to\nautomatically format code when it is staged for a commit.\nThis means that code that is pushed to the repo is always formatted to a consistent standard.\n\nYou can manually run the formatter with `npm run prettier` if you want.\n\nPrettier is slightly configured in [package.json#prettier](/package.json)\nand can ignores files using [.prettierignore](/.prettierignore).\n\n\u003c!-- WIP --\u003e\n\n### Releasing\n\nThis repo uses [GitHub Actions](https://docs.github.com/en/actions)\nto build a container when you tag a commit.\nThis is designed to be used with [npm version](https://docs.npmjs.com/cli/version)\nso all container images are [semantically versioned](https://semver.org/).\nThe `:latest` docker tag is not used.\n\nThis job is defined in [.github/workflows/container.yml](/.github/workflows/container.yml)\nwhich builds a container according to the the [Dockerfile](/Dockerfile)\nand **only** runs when you push a [tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging).\n\n```bash\n# Deploy a new version of the CLI\nnpm version # major | minor | patch\ngit push --tags\n```\n\n---\n\n\u003e This project was set up by [puggle](https://npm.im/puggle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinteraction%2Fnetlify-cms-github-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalinteraction%2Fnetlify-cms-github-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinteraction%2Fnetlify-cms-github-auth/lists"}