Usage

Prerequisites

Magic SDK offers two OAuth extensions: v1 and v2. For web applications, it is recommended to use v2, while v1 should be used for mobile applications.

Twitch Setup (v1 extension)

After installing the OAuth extension, you can now enable Twitch Login for your Magic app:
  1. Go to your Magic Dashboard
  2. Select the Magic app for which you’d like to enable Twitch Login, or create a new app
  3. Navigate to Social Login from the sidebar
  4. Click the toggle for Twitch
  5. Copy the Redirect URI field from your Magic Dashboard
  6. Follow Twitch’s registration instructions to register your app
  7. Paste Redirect URI into the OAuth Redirect URLs
register-your-application
  1. After creation of your Twitch app, click Manage
manage-your-app.png
  1. In the manage application section, click New Secret
generate-client-secret.png
  1. Obtain the Client ID and Client Secret
  2. Return to your Magic Dashboard and input the Client ID and Client Secret for your Twitch OAuth app
  3. In Magic Dashboard, click “Save”
  4. Click “Test Connection” to give your new Twitch OAuth flow a try!

Twitch Setup (v2 extension)

  • Follow above steps, but disregard Magic’s Redirect URI in step 5
  • In step 7, paste the Redirect URI you are passing in as the redirectURI argument to the loginWithRedirect method
JavaScript
await magic.oauth2.loginWithRedirect({
  provider: 'twitch',
  redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Twitch
});

Resources