{"id":17169660,"url":"https://github.com/jb3/discord-oauth2-gate","last_synced_at":"2026-01-20T03:02:56.610Z","repository":{"id":40704526,"uuid":"350435345","full_name":"jb3/discord-oauth2-gate","owner":"jb3","description":"Cloudflare Worker for Discord OAuth2 Authentication","archived":false,"fork":false,"pushed_at":"2023-01-07T06:41:01.000Z","size":316,"stargazers_count":1,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T04:43:57.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jb3.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-03-22T17:42:14.000Z","updated_at":"2022-10-15T06:49:18.000Z","dependencies_parsed_at":"2023-02-06T14:15:19.243Z","dependency_job_id":null,"html_url":"https://github.com/jb3/discord-oauth2-gate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jb3/discord-oauth2-gate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jb3%2Fdiscord-oauth2-gate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jb3%2Fdiscord-oauth2-gate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jb3%2Fdiscord-oauth2-gate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jb3%2Fdiscord-oauth2-gate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jb3","download_url":"https://codeload.github.com/jb3/discord-oauth2-gate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jb3%2Fdiscord-oauth2-gate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28594958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"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":[],"created_at":"2024-10-14T23:26:57.316Z","updated_at":"2026-01-20T03:02:56.588Z","avatar_url":"https://github.com/jb3.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord OAuth2 Gate\n\nA Cloudflare Worker to protect access to your web properties by checking if users have a ceretain role in your Discord server.\n\n## Configuration\n\n### Clone repository and setup Wrangler\n\nClone this repository locally and setup the Cloudflare [`wrangler`](https://github.com/cloudflare/wrangler) tool which is used to manage workers.\n\n### Deploy to Workers\n\nFirst off, you'll need to deploy the worker to a route.\n\nYou should update the `wrangler.toml` file to look something like this:\n\n```toml\nname = \"discord-oauth2-gate\"\ntype = \"webpack\"\naccount_id = \"\u003ctaken from cloudflare dashboard\u003e\"\nworkers_dev = false\nroute = \"your.domain.example/*\"\nzone_id = \"\u003ctaken from cloudflare dashboard\u003e\"\nwebpack_config = \"webpack.config.js\"\n```\n\nOnce you've done this run `wrangler publish`.\n\n### Setup Discord\n\nYou'll need to head to the Discord [Developer Portal](https://discord.com/developers/) and create a new application. You should also create a bot user for the application which will be used to fetch roles from a user.\n\nUse the invite link generators there to invite the bot user to the server you want to search for role members in.\n\n### Configure\n\nNext up add the following environment variables. You can use either wrangler with `wrangler secret put SECRET_NAME` (it will ask you then to input the variable) or alternatively through the web UI on the Workers dashboard.\n\n| Variable name                  | Description                                                             | Example value                                                 |\n| ------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------------------- |\n| `DISCORD_OAUTH2_CLIENT_ID`     | Discord OAuth2 Client ID taken from the Developer Portal                | `112233445566778899`                                          |\n| `DISCORD_OAUTH2_CLIENT_SECRET` | Discord OAuth2 Client Secret taken from the Developer Portal            | `cj6ufYg6mG1K0r4TfRUuVUpt-S8vPDOX`                            |\n| `DISCORD_BOT_TOKEN`            | Discord Bot Token taken from the Developer Portal under the bot section | `MTEyMjMzNDQ1NTY2Nzc4ODk5.WAkN_A.WQqsOdZJmMzITMROyVLZh5hQWEs` |\n| `GUILD_ID`                     | The Guild ID which the members should be on.                            | `267624335836053506`                                          |\n| `TARGET_ROLE_ID`               | The role which users must have in order to use the web service.         | `267630620367257601`                                          |\n| `WORKER_URI`                   | The URI the worker is deployed on, **including the trailing slash**.    | `https://myservice.seph.club/`                                |\n| `SECRET_KEY`                   | A random set of characters used as a signing secret for the JWT tokens. | `CL8o0COz6u4iiicKZ06DEaP6PAZqhCNKlaG`                         |\n\nYou may need to redeploy with `wrangler publish` to start the application again.\n\n### Good to go!\n\nAfter this you should be good! Visit any page on your protected service and you should have to pass through a Discord OAuth2 shield first.\n\nIf anything doesn't seem right feel free to open an issue!\n\n## Caveats\n\n- At the moment, only one role can be used for access control *per* deployment of this worker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjb3%2Fdiscord-oauth2-gate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjb3%2Fdiscord-oauth2-gate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjb3%2Fdiscord-oauth2-gate/lists"}