{"id":27452081,"url":"https://github.com/mcdeck/netlify-cms-oauth-provider-php","last_synced_at":"2025-04-15T11:39:44.239Z","repository":{"id":54622605,"uuid":"332288955","full_name":"mcdeck/netlify-cms-oauth-provider-php","owner":"mcdeck","description":"Oauth provider for Netlify CMS.","archived":false,"fork":false,"pushed_at":"2022-02-16T21:22:25.000Z","size":57,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-03-06T13:38:22.404Z","etag":null,"topics":["github","gitlab","netlify-cms","oauth2","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/mcdeck.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-01-23T19:14:19.000Z","updated_at":"2022-12-26T13:28:48.000Z","dependencies_parsed_at":"2022-08-13T21:50:39.279Z","dependency_job_id":null,"html_url":"https://github.com/mcdeck/netlify-cms-oauth-provider-php","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/mcdeck%2Fnetlify-cms-oauth-provider-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcdeck%2Fnetlify-cms-oauth-provider-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcdeck%2Fnetlify-cms-oauth-provider-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcdeck%2Fnetlify-cms-oauth-provider-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcdeck","download_url":"https://codeload.github.com/mcdeck/netlify-cms-oauth-provider-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249062450,"owners_count":21206692,"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":["github","gitlab","netlify-cms","oauth2","php"],"created_at":"2025-04-15T11:39:41.499Z","updated_at":"2025-04-15T11:39:44.233Z","avatar_url":"https://github.com/mcdeck.png","language":"PHP","funding_links":[],"categories":["OAuth Client"],"sub_categories":[],"readme":"# netlify-cms-oauth-provider-php\n\n***External authentication providers were enabled in netlify-cms version 0.4.3. Check your web console to see your netlify-cms version.***\n\n[netlify-cms](https://www.netlifycms.org/) has its own github OAuth client, which works with this implementation. So it's not necessary to reimplement client part.\n\nGithub, Github Enterprise and Gitlab are currently supported.\n\nOther implementations in: \n* [Node](https://github.com/vencax/netlify-cms-github-oauth-provider) - which was the main inspiration for this\n* [PHP](https://github.com/TSV-Zorneding-1920/netlify-cms-oauth-provider-php) that did not work for me...\n* [Go lang](https://github.com/igk1972/netlify-cms-oauth-provider-go).\n\n## Setup\n\n### Install Repo Locally\n\n```bash\ngit clone https://github.com/mcdeck/netlify-cms-oauth-provider-php\ncd netlify-cms-oauth-provider-php\ncomposer install\n```\n\n### Create Oauth App\n\nInformation is available on the [Github Developer Documentation](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/registering-oauth-apps/) or [Gitlab Docs](https://docs.gitlab.com/ee/integration/oauth_provider.html). Fill out the fields however you like, except for **authorization callback URL**. This is where Github or Gitlab will send your callback after a user has authenticated, and should be `https://your.server.com/callback` for use with this repo.\n\n## Configure\n\n### Auth Provider Config\n\nConfiguration is done with environment variables, which can be supplied as command line arguments, added in your app hosting interface, or loaded from a .env ([symfony env files](https://symfony.com/doc/current/configuration.html#configuration-environments)) file.\n\n**Example .env.local file:**\n\n```ini\n# Default values for GitHub - leave as they are\n# OAUTH_PROVIDER=github\n# SCOPES=api,user,repo\n# overwrite for GitHub Enterprise\n# OAUTH_DOMAIN=https://github.com\nOAUTH_CLIENT_ID=11111111111111\nOAUTH_CLIENT_SECRET=22222222222222222222222222222222222\nREDIRECT_URI=https://auth.example.com/callback/\nORIGIN=example.com\n\n# Set to production environment when deploying\nAPP_ENV=prod\n```\n\nFor Gitlab you also have to provide these environment variables:\n```ini\n# You can customize this to your URL for self-hosted GitLab instances\nOAUTH_DOMAIN=https://gitlab.com\nOAUTH_PROVIDER=gitlab\nSCOPES=api\n```\n\n**Client ID \u0026 Client Secret:**\nAfter registering your Oauth app, you will be able to get your client id and client secret on the next page.\n\n**Redirect URL (optional in github, mandatory in gitlab):**\nInclude this if you need your callback to be different from what is supplied in your Oauth app configuration.\n\n**Git Hostname (Default github.com):**\nThis is only necessary for use with Github Enterprise or Gitlab.\n\n### CMS Config\nYou also need to add `base_url` to the backend section of your netlify-cms's config file. `base_url` is the live URL of this repo with no trailing slashes.\n\n```yaml\nbackend:\n  name: [github | gitlab]\n  repo: user/repo   # Path to your Github/Gitlab repository\n  branch: master    # Branch to update\n  base_url: https://auth.example.com # Path to ext auth provider\n```\n\n## Testing\n\nIf you want, you can run your local copy with using Symfony's built-in web server.\nBefore you do that, create an `.env.local` file with an oauth client id that is configured to redirect to http://localhost:8000/callback\n\n```yaml\nOAUTH_CLIENT_ID=clientidfromgithub\nOAUTH_CLIENT_SECRET=clientsecretfromgithub\nREDIRECT_URI=http://localhost:8000/callback/\nORIGIN=.*\n```\n\nThen start the web server\n\n```bash\ncd netlify-cms-oauth-provider-php\nsymfony serve\n``` \n\nThis launches a webserver on http://localhost:8000/ which you can use in your `config.yml`.\n\n```yaml\nbackend:\n  name: github\n  repo: mcdeck/dad-on-tech.com\n  branch: main\n  \n  base_url: http://localhost:8000\n```\n\n## Deploy\n\n### FTP\n\nCreate an `.env.local` file next to `.env` and set `CLIENT_ID`, `CLIENT_SECRET` and `REDIRECT_URL` as per the example above.\n\nUpload to everyhting and point your webserver to `public` folder, or chose whatever method you normally chose to deploy Symfony apps.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcdeck%2Fnetlify-cms-oauth-provider-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcdeck%2Fnetlify-cms-oauth-provider-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcdeck%2Fnetlify-cms-oauth-provider-php/lists"}