Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetSubscriptions: Client hangs indefinitely when refresh token and Wrong scopes are provided. #227

Open
coolapso opened this issue Aug 14, 2024 · 0 comments

Comments

@coolapso
Copy link

coolapso commented Aug 14, 2024

Hi, Apologies if this is the wrong place for this, but not entirely sure where to start.

Recently I found out the client gets hung and never returns a response when using the Get Subscriptions method while having the client setup with A refresh token and a wrong Scope.

How to reproduce:

Generate a new access token, ie using Twitch cli or your favorite method, with the scope [user:read:subscriptions]
Create a new helix client and provide The following Options: UserAccessToken, ClientID and ClientSecret
Make a client.GetSubscriptions() request, response should be returned, with wrong scope error
Add the refresh token to your client options
Make a new request, observe client get hung indefinitely and never return a response.

Sample code:

package main

import (
	"fmt"
	"log"
	helix "github.com/nicklaw5/helix/v2"
)


const (
	userID = "YourUserIDHere"
)

func main() {
 	client, err := helix.NewClient(&helix.Options{
		UserAccessToken: "UserAccessToken",
		RefreshToken: "RefreshToken",
		ClientID: "ClientID",
		ClientSecret: "ClientSecret",
	})
	if err != nil { 
		log.Fatal("Failed to create new client:", err)
	}

	resp, err := client.GetSubscriptions(&helix.SubscriptionsParams{
		BroadcasterID: userID,
	})
	if err != nil {
		log.Fatal("Failed to get subs:", err)
	}

	fmt.Println(resp)
}

Hope I'm providing everything you need to track this down. Let me know if you need more details and if I can somehow help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant