{"id":18850273,"url":"https://github.com/herohtar/netlify-cms-oauth-firebase","last_synced_at":"2025-04-14T09:21:43.300Z","repository":{"id":38810459,"uuid":"149921784","full_name":"Herohtar/netlify-cms-oauth-firebase","owner":"Herohtar","description":"Firebase Cloud Function based OAuth2 GitHub backend for Netlify CMS","archived":false,"fork":false,"pushed_at":"2023-01-09T17:07:35.000Z","size":477,"stargazers_count":66,"open_issues_count":9,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T22:42:58.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Herohtar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-22T21:27:58.000Z","updated_at":"2025-02-04T12:43:49.000Z","dependencies_parsed_at":"2023-02-08T13:01:34.075Z","dependency_job_id":null,"html_url":"https://github.com/Herohtar/netlify-cms-oauth-firebase","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Herohtar%2Fnetlify-cms-oauth-firebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Herohtar%2Fnetlify-cms-oauth-firebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Herohtar%2Fnetlify-cms-oauth-firebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Herohtar%2Fnetlify-cms-oauth-firebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Herohtar","download_url":"https://codeload.github.com/Herohtar/netlify-cms-oauth-firebase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852189,"owners_count":21171843,"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-11-08T03:28:41.597Z","updated_at":"2025-04-14T09:21:43.262Z","avatar_url":"https://github.com/Herohtar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# netlify-cms-oauth-firebase\n\nThis is a [Firebase Cloud Function](https://firebase.google.com/docs/functions/) that allows [Netlify CMS](https://www.netlifycms.org/) to authenticate with GitHub or GitLab via OAuth2.\n\n## Setup\n### 0) Prerequisites\nThese instructions assume that you have already created a [Firebase](https://firebase.google.com/) project and have installed and configured the [Firebase CLI Tools](https://github.com/firebase/firebase-tools). See the [Firebase CLI Reference](https://firebase.google.com/docs/cli/) for more details.\n\n**Note:** The Firebase project must be configured to use the **Blaze** plan, as the function needs to be able to make outbound network requests to non-Google services. Additionally, the function uses the Node.js 10 runtime, which is not available on the free plan.\n\n### 1) Get the code\nClone the repository and install dependencies:\n```\ngit clone https://github.com/Herohtar/netlify-cms-oauth-firebase\ncd netlify-cms-oauth-firebase/functions\nnpm i\ncd ..\n```\n\n### 2) Create an OAuth app\nYou will need an OAuth app to authenticate with. For GitHub, the instructions can be found in the [GitHub Developer Documentation](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/).\n\nFor now, the values that you provide for the fields do not matter. The **authorization callback URL** will need to be configured once you have the Firebase Function URL in order for the service to work.\n\n### 3) Configure the Firebase environment\nTell Firebase which project to use:\n```\nfirebase use your-project-id\n```\n\nSet the `oauth.client_id` and `oauth.client_secret` Firebase environment variables using the values from the GitHub OAuth app:\n```\nfirebase functions:config:set oauth.client_id=yourclientid oauth.client_secret=yourclientsecret\n```\n\nFor GitHub Enterprise and GitLab you will need to set the `oauth.git_hostname` environment variable.\n\nFor GitLab you will also need to set the following additional environment variables as specified:\n```\noauth.provider=gitlab\noauth.scopes=api\noauth.authorize_path=/oauth/authorize\noauth.token_path=/oauth/token\n```\n\n### 4) Deploy the function\nDeploy the function to Firebase:\n```\nfirebase deploy --only functions\n```\n\nAt this point you should update the **authorization callback URL** in your GitHub OAuth app's settings to point to the URL of your Firebase function, which should be of the form: `https://us-central1-your-project-id.cloudfunctions.net/oauth/callback`\n\n### 5) Configure Netlify CMS\nFinally, update your Netlify CMS `config.yml` to point to the function:\n```yaml\nbackend:\n  name: github # Or gitlab\n  repo: username/repo # Your username and repository\n  branch: master # Branch to use\n  base_url: https://us-central1-your-project-id.cloudfunctions.net # The base URL for your Firebase Function\n  auth_endpoint: /oauth/auth # The path to the OAuth endpoint of the function\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherohtar%2Fnetlify-cms-oauth-firebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherohtar%2Fnetlify-cms-oauth-firebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherohtar%2Fnetlify-cms-oauth-firebase/lists"}