I am attempting to get a user’s subscription status but I can’t get Helix to believe I have the appropriate claims. The frontend helper provides this data but, in theory, it’s open to manipulation by the client so this isn’t reliable. I want to pull the verification in to the backend.
This extension is under development and has not gone through onboarding. I have done the following:
The connection is visible in my connection’s list. Helix otherwise works for other things.
Do I need to go through onboarding before I can get this claim? Am I missing something else?
Thanks.
You called the wrong API
The extension permission give access to channel:read:subscriptions for use with Reference | Twitch Developers
You called Reference | Twitch Developers which uses user:read:subscriptions hence the error
Edit: filed a documentation bug here Check User Subscription - Extension permission · Issue #1168 · twitchdev/issues · GitHub
Thanks for looking. Unfortunately I tried both of these APIs and I get the same error. The token never has a non-empty scope regardless of broadcaster authorization.
The only way around this so far is to throw the broadcaster through the oauth flow during setup and store the refresh token.
I can post more detailed logs in a bit.
You are using an App Access Token generated using an Extension ClientID and secret?
Those will never "claim’ to have scopes.
But an extension App Access token will inherit the permission:
A Twitch extensions may use an app access token if the broadcaster has granted the channel:read:subscriptions scope from within the Twitch Extensions manager.
I have checked this morning and it’s working as expected for me. (and I’m not done a manual oAuth for the streamer against the extension clientID in question just the install)
Getting OAuth Access Tokens | Twitch Developers
I am using the client and secret associated with the application retrieved from: Twitch Developers
[helix] app access token: POST https://id.twitch.tv/oauth2/token {
[ebs] client_id: ‘cv8fzj…’,
[ebs] client_secret: ‘z115wm…’,
[ebs] grant_type: ‘client_credentials’
[ebs] }
[ebs] [helix] app access token: response {
[ebs] status: 200,
[ebs] body: {
[ebs] access_token: ‘5fhdq…y’,
[ebs] expires_in: 5188650,
[ebs] token_type: ‘bearer’
[ebs] }
[ebs] }
GET https://api.twitch.tv/helix/subscriptions?broadcaster_id=59082980&user_id=59082980
{“error”:“Unauthorized”,“status”:401,“message”:“Missing scope: channel:read:subscriptions or channel_subscriptions”}
Using the extension id and secret just results in a 403 with invalid client id.
If I use a broadcaster token then I get the claim I’d expect.
And the extension is installed/active on sinapse channel?
Is this extension release or in test?
That might be the problem you are on /apps instead of /extensions and are not using the Extension Details but a different Client ID to the extension? Since extension do not appear on the apps list
Example:
Okay, that was the issue. I wasn’t using the client id and the API client secret from the extensions section. I think this would’ve been prevented if there was a specific callout for extensions in Get Started | Twitch Developers
Thank you for the help!