> ## Documentation Index
> Fetch the complete documentation index at: https://ogh.riturajbasak.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream Live to Twitch from Ogh

> Connect your Twitch account to Ogh using Device Authorization — no browser redirect or client secret needed.

Ogh's Twitch integration lets you stream directly to your Twitch channel without
entering a stream key by hand. Ogh uses the Twitch Device Authorization Grant, a
flow designed for devices and native apps: your browser opens the Twitch
verification page, you enter a short code and approve, and Ogh handles the rest.
There is no redirect URI and no client secret involved. Once connected, Ogh
fetches your stream key in memory before each session so you never have to manage
it yourself.

<Note>
  Twitch uses Device Authorization — no browser redirect, no client secret. Ogh
  opens the Twitch-provided verification page directly in your browser.
</Note>

## Connect your Twitch account

<Steps>
  <Step title="Open Settings > Platforms">
    From the Ogh Preview screen, tap the **Settings** icon, then tap
    **Platforms**.
  </Step>

  <Step title="Tap Connect next to Twitch">
    Tap **Connect** beside the Twitch entry. Ogh requests a device code from
    Twitch and displays a short user code on screen.
  </Step>

  <Step title="Authorize in your browser">
    Your browser opens the Twitch verification page. Enter the code shown in
    Ogh and tap **Authorize** to grant Ogh access to your channel.
  </Step>

  <Step title="Ogh confirms the connection">
    Ogh polls Twitch for confirmation. Once Twitch reports that you have
    authorized, Ogh stores your account record and creates a Twitch destination.
    Your channel name appears in Platforms to confirm the connection.
  </Step>
</Steps>

## Permission Ogh requests

Ogh requests the `channel:read:stream_key` scope. This allows Ogh to read your
channel's private stream key. No other permissions are requested.

## What Ogh does with your Twitch account

* **Reads your stream key** immediately before each session starts. The key is
  held in memory only and is never written to disk.
* **Forms the Twitch RTMP ingest endpoint** in memory using the retrieved key.
  The endpoint is cleared as soon as your session ends.

<Note>
  Your Twitch stream key is never written to disk. It is held in memory only
  during a live session and is cleared when the session ends.
</Note>

## Disconnect Twitch

<Steps>
  <Step title="Open Settings > Platforms">
    Tap the **Settings** icon from Preview, then tap **Platforms**.
  </Step>

  <Step title="Tap Disconnect next to Twitch">
    Tap **Disconnect**. Ogh sends a revocation request to Twitch, then deletes
    your local tokens and account record. The Twitch destination is removed.
  </Step>
</Steps>

## Troubleshooting

**The device code expires before you authorize.**
Device codes have a limited validity window. If you see an expiry message in
Ogh, tap **Connect** again to request a fresh code and restart the flow.

**You denied authorization on the Twitch verification page.**
Ogh returns to the ready state without creating a destination. Tap **Connect**
whenever you are ready to try again.

**Ogh shows a polling error.**
Twitch occasionally asks clients to slow down polling. Ogh handles this
automatically, but if the error persists, tap **Disconnect** (if a partial
record was created) and then **Connect** to start a clean flow.

**The Twitch destination disappears after reconnecting.**
If your authorization token expires or is revoked on Twitch's side, Ogh will
fail to retrieve your stream key at session start. Go to **Settings > Platforms**
and reconnect your account.
