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

Client does not use AppAccessToken on calls that must use AppAccessToken #130

Open
Cidan opened this issue Nov 6, 2021 · 4 comments
Open

Comments

@Cidan
Copy link

Cidan commented Nov 6, 2021

When creating a client with both an AppAccessToken and a UserAccessToken, the client favors the UserAccessToken over the AppAccessToken. However, certain Helix API calls require the use of an AppAccessToken, i.e. CreateEventSubSubscription.

The client should automatically use the AppAccessToken field for calls that require AppAccessToken, or otherwise allow AppAccessToken to be passed in per call as in #128.

@gempir
Copy link
Contributor

gempir commented Nov 9, 2021

Had this issue before as well. From experience it's best and maybe even recommended? To Set the UserAccessToken before you do that request and then clear it again after.

Maybe that's done intentionally since UserAccessTokens and has to be switch for each user anyway, but then It should just be an argument in the function IMO

@Cidan
Copy link
Author

Cidan commented Nov 9, 2021

What I ended up doing as a work around is instantiating a second client just for calls that need an AppAccessToken and making sure to never set a UserAccessToken on it. I really want to avoid mutating state where possible in order to reduce possible bugs during concurrency.

@nicklaw5
Copy link
Owner

nicklaw5 commented Nov 9, 2021

I think the solution here is to implement the proposal in #128.

@Cidan
Copy link
Author

Cidan commented Nov 9, 2021

I think you're probably right.

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

3 participants