2025-12-20 07:27:35 +00:00
2025-10-25 07:36:08 -07:00
2025-10-25 07:36:08 -07:00
2025-10-25 07:50:44 -07:00
2025-12-17 02:16:38 -08:00
2025-01-18 07:47:59 +00:00
2025-12-15 23:02:51 -08:00
2025-01-18 07:47:59 +00:00
2025-10-25 08:50:42 -07:00
2025-12-17 00:25:08 -08:00
2025-12-20 07:27:35 +00:00
2025-10-25 07:36:08 -07:00
2025-10-25 07:36:08 -07:00

Twitch Cloud EBS

This is a server-side component providing cloud storage and OAuth Code Grant Flow access to otherwise client-side only software.

Deploying

Cloudflare Workers

Previously, there was a "deploy to cloudflare" button here, but it seems to only work with GitHub repos, so you'll have to clone and deploy this yourself.

Docker

Previously, this repo produced oci images, but they were inclomlete and more work is needed before they are ready.

Twurple Module

https://gitea.sugoidogo.com/sugoidogo/-/packages/npm/@sugoidogo%2Ftwitch-cloud-ebs/

This API provides two Twurple modules, one for authorization and one for storage, allowing for easy integration if you're already using the Twurple javascript library. the WebStorage module can be used to cache fetched resources from anywhere, but when used as demonstrated below, allows your client to maintain access to previously stored resources from cloud storage via the browser's CacheStorage API.

javascript
import { SugoiAuthProvider, WebStorage } from '@sugoidogo/twitch-cloud-ebs'
import { ApiClient } from '@twurple/ebs';

const ebs_host='https://your.ebs.hostname'
const authProvicder=new SugoiAuthProvider('your-client-id',ebs_host)
const webStorage=new WebStorage(authProvider,undefined,ebs_host)
const apiClient = new ApiClient({ authProvider });

const config=await webStorage.fetch('config.json').then(response=>response.json())

Usage

/oauth2/token

This endpoint is a proxy to https://id.twitch.tv/oauth2/token that adds the client_secret to your request body, in order to allow your client software to get a refresh token using the OAuth Code Grant Flow without exposing your client secret to end user devices. When this software was written, this was the only way to get a refresh token, and remains the only way to get a non-expiring refresh token, however Twitch has now added the Device Code Grant Flow which grants you a refresh token that expires 30 days after refreshing. Consider if this new flow is acceptable for your application before using this endpoint.

Storage

All locations outside of /oauth or the provided javascript modules are part of the storage API, which allows you to GET, PUT, or DELETE files from cloud storage, scoped to the client-id and user-id of the token provided in the authorization header, which uses the same authorization scheme as the Twitch API.

S
Description
No description provided
Readme 348 KiB
Languages
TypeScript 100%