Skip to main content

Twitch

Creating a custom Twitch OAuth application

The step-by-step instructions below follow Twitch's documentation on Using OAuth 2.0 for authentication.

Create credentials for ngrok

  1. Navigate to the Twitch developer console, sign in, click Applications on the left menu, and then click Register Your Application.

  2. On the Register Your Application page, provide a Name for your application, enter https://idp.ngrok.com/oauth2/callback in the OAuth Redirect URLs field, select Website Integration in the Category selector, and then click Create.

    Note: Make sure you have two-factor authentication enabled for your Twitch account.

  3. On the Developer Applications page, click Manage for your application.

  4. On the application page, click New Secret, and make a note of the Client ID and Client Secret values.

Update your ngrok endpoint traffic policy

  1. Access the ngrok Dashboard Endpoints page and locate an existing endpoint you'd like to add this to or create a new one.
  2. In your traffic policy, add the following configuration:
---
on_http_request:
- actions:
- type: oauth
config:
provider: twitch
client_id: "{your app's oauth client id}"
client_secret: "{your app's oauth client secret}"
scopes:
- user:read:email
- openid
  1. Click Save to validate and update your traffic policy.

Configure access control

Optionally, configure access control to your service by only allowing specific users or domains. For example:

# Only allow access to me@example.com. Add this after your OAuth Action.
---
on_http_request:
- expressions:
- "!(actions.ngrok.oauth.identity.email in ['me@example.com'])"
actions:
- type: deny

Additional application setup information