{"id":35155032,"url":"https://github.com/lenoxys/oauth-php-for-sveltia","last_synced_at":"2026-01-13T21:07:41.036Z","repository":{"id":330853491,"uuid":"1124192566","full_name":"lenoxys/oauth-php-for-sveltia","owner":"lenoxys","description":"Lightweight PHP OAuth handler for Sveltia CMS — enables sign-in with GitHub and GitLab (including self-hosted GitLab instances). Deploy it at `static/oauth` to add OAuth-based admin login with minimal setup and no extra server-side dependencies.","archived":false,"fork":false,"pushed_at":"2025-12-28T15:06:45.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-31T02:54:34.427Z","etag":null,"topics":["github-oauth","gitlab-aouth","oauth","php","sveltia-cms"],"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/lenoxys.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-28T14:33:42.000Z","updated_at":"2025-12-28T15:20:40.000Z","dependencies_parsed_at":"2025-12-31T11:02:01.036Z","dependency_job_id":null,"html_url":"https://github.com/lenoxys/oauth-php-for-sveltia","commit_stats":null,"previous_names":["lenoxys/oauth-php-for-sveltia"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lenoxys/oauth-php-for-sveltia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenoxys%2Foauth-php-for-sveltia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenoxys%2Foauth-php-for-sveltia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenoxys%2Foauth-php-for-sveltia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenoxys%2Foauth-php-for-sveltia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lenoxys","download_url":"https://codeload.github.com/lenoxys/oauth-php-for-sveltia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lenoxys%2Foauth-php-for-sveltia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28400732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-oauth","gitlab-aouth","oauth","php","sveltia-cms"],"created_at":"2025-12-28T16:48:47.490Z","updated_at":"2026-01-13T21:07:41.031Z","avatar_url":"https://github.com/lenoxys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sveltia OAuth Handler (PHP)\n\nSimple PHP OAuth handler for Sveltia CMS supporting GitHub and GitLab.\n\nBased on: https://github.com/sveltia/sveltia-cms-auth\n\n---\n\n## Quick start\n\n1. Install into your site at `static/oauth` (clone or submodule):\n\n```bash\n# clone\ngit clone https://github.com/lenoxys/oauth-php-for-sveltia static/oauth\n# or as a submodule (recommended for upstream tracking)\ngit submodule add https://github.com/lenoxys/oauth-php-for-sveltia.git static/oauth\n```\n\n2. Set required environment variables (see summary below), including `ALLOWED_DOMAINS`.\n3. Set `backend.base_url` in `static/admin/config.yml` to `https://your-site.com/oauth`.\n4. Visit Sveltia admin, click \"Login with GitHub\" or \"Login with GitLab\" and complete the flow.\n\n---\n\n## Register OAuth App\n\n- GitHub: create an OAuth App with callback `https://your-site.com/oauth/callback` and copy the Client ID/Secret.\n- GitLab: create an Application with redirect URI `https://your-site.com/oauth/callback` and copy the ID/Secret.\n\n---\n\n## Environment variables (minimum)\n\n- `ALLOWED_DOMAINS` **(required)** — comma-separated domains (supports leading `*.` patterns).\n- `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` — for GitHub provider.\n- `GITLAB_CLIENT_ID`, `GITLAB_CLIENT_SECRET`, `GITLAB_HOSTNAME` — for GitLab (hostname defaults to `gitlab.com`).\n- `DEBUG_OAUTH=1` enables sanitized debug logging.\n\nSet these in your PHP environment (.env, PHP-FPM, Apache, etc.).\n\n---\n\n## How it works (short)\n\n- `GET /auth` (or `/oauth/authorize`) starts the OAuth flow with `provider=github|gitlab` and `site_id` (must be in `ALLOWED_DOMAINS`).\n- Provider redirects to `GET /callback` (or `/oauth/redirect`), the handler exchanges the code for a token and posts the token back to Sveltia CMS.\n\n---\n\n## Security \u0026 restrictions\n\n- Requires `ALLOWED_DOMAINS` (fail-closed by default).\n- CSRF protection via HttpOnly cookies and state tokens.\n- Token exchanges are protected against SSRF by validating resolved IPs and using pinned cURL resolves.\n- Debug logs are sanitized to avoid exposing secrets.\n\n---\n\n## Troubleshooting\n\n- \"Domain not allowed\": check `ALLOWED_DOMAINS` and `site_id` in your request.\n- Missing client ID/secret: ensure they are available in the PHP process environment.\n- Callback/code issues: verify OAuth app callback URL matches your site.\n- HTTPS is required for secure cookies and production use.\n\n---\n\n## Install \u0026 Update\n\nInstall the handler into `static/oauth` (clone or submodule). Update commands:\n\n- Clone: `cd static/oauth \u0026\u0026 git pull`\n- Submodule: `git submodule update --remote --merge`\n- To update to a specific release: fetch the tag or download the release archive and extract `static/oauth` only\n\nNotes:\n- If you modify the handler, prefer a fork or manage updates via releases to avoid overwriting local changes.\n\n---\n\n## File layout\n\n```\nstatic/oauth/\n├─ index.php\n├─ .htaccess\n└─ README.md\n```\n\n---\n\n## References \u0026 License\n\n- Sveltia CMS: https://github.com/sveltia/sveltia-cms\n- Sveltia CMS Auth: https://github.com/sveltia/sveltia-cms-auth\n- GitHub/GitLab OAuth docs linked in the project\n\nLicense: MIT (same as Sveltia CMS)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenoxys%2Foauth-php-for-sveltia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flenoxys%2Foauth-php-for-sveltia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flenoxys%2Foauth-php-for-sveltia/lists"}