fix
This commit is contained in:
@ -42,15 +42,24 @@ export const twitchFollowEvent = z.object({
|
||||
// Webhook -> Redeem of channel reward
|
||||
export const createTwitchClient = () => {
|
||||
const getAccessToken = async () => {
|
||||
const twitchAuthResponse = await fetch(
|
||||
`https://id.twitch.tv/oauth2/token?client_id=${TWITCH_APP_CLIENT_ID}&client_secret=${TWITCH_APP_SECRET}&grant_type=client_credentials&&redirect_uri=https://twitch.johncosta.tech/redirect&scope=moderator:read:followers`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
const authUrl = `https://id.twitch.tv/oauth2/authorize` +
|
||||
`?response_type=code` +
|
||||
`&client_id=${TWITCH_APP_CLIENT_ID}` +
|
||||
`&redirect_uri=${encodeURIComponent("https://twitch.johncosta.tech/redirect")}` +
|
||||
`&scope=moderator:read:followers`
|
||||
|
||||
|
||||
const twitchAuthResponse =
|
||||
await fetch(
|
||||
authUrl,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
const { access_token } = authBodyValidator.parse(
|
||||
await twitchAuthResponse.json(),
|
||||
|
Reference in New Issue
Block a user