{"id":22521077,"url":"https://github.com/instafluff/comfytwitch","last_synced_at":"2025-08-03T20:30:59.431Z","repository":{"id":40815806,"uuid":"235220769","full_name":"instafluff/ComfyTwitch","owner":"instafluff","description":"Comfiest Way to Add Serverless Twitch Authentication","archived":false,"fork":false,"pushed_at":"2024-03-27T03:18:13.000Z","size":96,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T22:41:22.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/instafluff.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":"2020-01-20T23:50:42.000Z","updated_at":"2022-10-22T21:20:40.000Z","dependencies_parsed_at":"2023-01-19T23:15:29.048Z","dependency_job_id":null,"html_url":"https://github.com/instafluff/ComfyTwitch","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/instafluff%2FComfyTwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instafluff%2FComfyTwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instafluff%2FComfyTwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instafluff%2FComfyTwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instafluff","download_url":"https://codeload.github.com/instafluff/ComfyTwitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228562270,"owners_count":17937234,"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-07T05:09:36.879Z","updated_at":"2024-12-07T05:09:37.538Z","avatar_url":"https://github.com/instafluff.png","language":"JavaScript","funding_links":["https://github.com/sponsors/instafluff"],"categories":[],"sub_categories":[],"readme":"# ComfyTwitch\nComfiest Way to Add Serverless Twitch Authentication\n\n**ComfyTwitch** lets you integrate Twitch authentication for websites without a server ***SUPER EASILY*** in just a few lines of code. It automatically caches the authentication in the browser so that users do not have to log in every single visit.\n\n## Instafluff ##\n\u003e *Like these projects? The best way to support my open-source projects is by becoming a Comfy Sponsor on GitHub!*\n\n\u003e https://github.com/sponsors/instafluff\n\n\u003e *Come and hang out with us at the Comfiest Corner on Twitch!*\n\n\u003e https://twitch.tv/instafluff\n\n## Demo ##\nTo see how it works, check out this static webpage that authenticates using Twitch OAuth: [https://www.instafluff.tv/ComfyTwitch](https://www.instafluff.tv/ComfyTwitch)\n\n## Instructions ##\n\n#### Prequisites\n1. Create a Twitch application from [https://dev.twitch.tv/console/apps/create](https://dev.twitch.tv/console/apps/create) to generate a Twitch Client ID\n\n2. Add an OAuth Redirect URL to your Twitch application for the authentication to redirect the user to afterwards. A local example would look like: `http://localhost:8800/index.html`\n\n#### Website\n\n1. Download  `comfytwitch.min.js` from the `web` folder or include from the JSDeliver CDN and add into every page you need authenticated:\n```javascript\n\u003cscript src=\"comfytwitch.min.js\"\u003e\u003c/script\u003e\n```\n\nOR\n\n```javascript\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/comfytwitch@latest/web/comfytwitch.min.js\"\u003e\u003c/script\u003e\n```\n\n2. Check for Twitch authentication using `ComfyTwitch.Check()` for whether or not the user is logged in.\n***The authentication is cached in the browser so that the user does not have to log in every time.***\n```html\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cscript src=\"https://cdn.jsdelivr.net/npm/comfytwitch@latest/web/comfytwitch.min.js\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cscript type=\"text/javascript\"\u003e\n            const clientId = \"YOUR-CLIENT-ID\";\n            const baseUrl = window.location.origin;\n\n            ComfyTwitch.Check()\n            .then( result =\u003e {\n                if( result ) {\n                    // Logged In\n                }\n                else {\n                    // Logged Out\n                }\n            });\n        \u003c/script\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n3. Add Twitch Log-In by calling `ComfyTwitch.Login()` on a button click or through a separate page, passing in the Client ID, the same Redirect URI as set in your Twitch application, and the [Twitch Permission Scopes](https://dev.twitch.tv/docs/authentication/#scopes) you need:\n```javascript\nComfyTwitch.Login( \"YOUR-CLIENT-ID\", `http://localhost:8800/index.html`, [ \"user:read:email\" ] );\n```\n\n4. Add Twitch Log-out by calling `ComfyTwitch.Logout()`\n\n## Additional Functions ##\n\n - **GetUser**`( clientId, userId )`\n    - Retrieve a Twitch user's information\n```javascript\nlet user = await ComfyTwitch.GetUser( \"YOUR-CLIENT-ID\", \"TWITCH-USER-ID\" );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstafluff%2Fcomfytwitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstafluff%2Fcomfytwitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstafluff%2Fcomfytwitch/lists"}