diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java index 64aedc8b5bcf3..66a7139ff86a1 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java @@ -1605,7 +1605,8 @@ public static enum Provider { GOOGLE, MICROSOFT, SPOTIFY, - TWITTER + TWITTER, + TWITCH } public Optional getProvider() { diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java index 97578c1078376..8424316099c4a 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/providers/KnownOidcProviders.java @@ -24,6 +24,8 @@ public static OidcTenantConfig provider(OidcTenantConfig.Provider provider) { return spotify(); } else if (OidcTenantConfig.Provider.TWITTER == provider) { return twitter(); + } else if (OidcTenantConfig.Provider.TWITCH == provider) { + return twitch(); } return null; } @@ -126,4 +128,22 @@ private static OidcTenantConfig spotify() { return ret; } + + private static OidcTenantConfig twitch() { + // Ref https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/#oidc-authorization-code-grant-flow + + OidcTenantConfig ret = new OidcTenantConfig(); + ret.setDiscoveryEnabled(true); + ret.setAuthServerUrl("https://id.twitch.tv/oauth2/"); + ret.setAuthorizationPath("authorize"); + ret.setTokenPath("token"); + ret.setUserInfoPath("https://id.twitch.tv/oauth2/userinfo"); + ret.setApplicationType(OidcTenantConfig.ApplicationType.WEB_APP); + ret.getAuthentication().setScopes(List.of("openid")); + ret.setAuthServerUrl("https://id.twitch.tv/oauth2/"); + ret.setAuthorizationPath("authorize"); + ret.getAuthentication().setIdTokenRequired(true); + + return ret; + } }