Authenticate with Twitch #

In this section, we’ll log into the platform with Twitch. This method is appropriate for use in production.

Prerequisites:

Register your application with Twitch #

Log into or create a new Twitch Developer account via the Twitch Developers login page.

Follow the official docs on the Twitch Docs site in order to register your application with Twitch.

Configure your application #

Once you have created a Twitch application, you will need to configure it. Navigate to the Twitch Developers console, then click the application’s Manage button.

Under OAuth Redirect URLs, enter the following URLs for local development:

  • http://localhost:11000/v1/account/twitch-redirect
  • http://localhost:3000/#/signin-twitch
  • http://localhost:11200/#/signin-twitch
  • https://pragma-social-player.local/#/signin-twitch

Under the Category dropdown, select Game Integration.

Take note of your Client ID and create and note your Client Secret as you will need them later. Keep in mind that Twitch will only show the Client Secret once. If you forget it, you will have to generate a new secret, which will invalidate the previously generated one.

Configure Pragma Engine #

Insert the following configuration into your 5-ext/config/local-dev.yml to enable the Twitch identity provider plugin:

social:
  pluginConfigs:
    AccountService.identityProviderPlugins:
      plugins:
        Twitch:
          class: "pragma.account.TwitchIdentityProviderPlugin"
          config:
            clientId: "${twitchClientId}"
            clientSecret: "${twitchClientSecret}"
            redirectUri: "http://localhost:11000/v1/account/twitch-redirect"
            playerLoginEnabled: false
            operatorLoginEnabled: false
            accountLinkingEnabled: true
            showPortalLoginButton: false
            visibleToOtherPlayers: false