This commit is contained in:
2025-06-30 19:03:00 +01:00
parent a498b6d450
commit 261d6d5215

View File

@ -1,3 +1,4 @@
import { building } from "$app/environment";
import { HASH_SECRET, TWITCH_APP_CLIENT_ID, TWITCH_APP_SECRET } from "$env/static/private";
import { z } from "zod";
@ -42,6 +43,10 @@ export const twitchFollowEvent = z.object({
// Webhook -> Redeem of channel reward
export const createTwitchClient = () => {
const getAccessToken = async () => {
if (building) {
return '';
}
const authUrl = `https://id.twitch.tv/oauth2/authorize` +
`?response_type=code` +
`&client_id=${TWITCH_APP_CLIENT_ID}` +
@ -71,7 +76,6 @@ export const createTwitchClient = () => {
const _access_token = getAccessToken();
const subscribeToFollow = async () => {
console.log(await _access_token);
const twitchSubResponse = await fetch(
"https://api.twitch.tv/helix/eventsub/subscriptions",
{