I have the right scope, I am authenticating correctly with my own app which is set up, as far as I can tell, under my main twitch account, LeRurik. This is the same account that I am querying followers for. The follower count matching suggests that its the correct account.
Any idea why I would not be getting the data?
The usual suggestion is that either the scope is missing, or that the authenticated user is not a mod on the channel. But how can I not be a mod of my own channel?
I have been trying to investigate this for a few hours now and am starting to get a bit frustrated, so any help would be appreciated.
To read whom follows who via the API requires a USER TOKEN not a Client Credentials token
Requires a user access token that includes the moderator:read:followers scope. The ID in the broadcaster_id query parameter must match the user ID in the access token or the user must be a moderator for the specified broadcaster. If a scope is not provided, only the total follower count will be included in the response.
It’s probably just late and I am not thinking clearly, but…
If I use the GrantType::AUTHORIZATION_CODE to get the access token at login, I then can’t actually log in the user. I also can’t get their display name/avatar for the user area because for that I would need their username or ID in the first place, which there doesn’t seem to be an endpoint for getting the user details for the current oauthed user?
I was able to successfully get the access token for myself by logging into my own site as myself, but it kind of defeats the purpose if I can’t get the rest of the info to go with it, as the code is one use only.
Sorry if this seems to be asking for too much help here, but I don’t see how I can do both flows with one code (create a user and get their access token), nor how I can only get the access token for my own account, as I don’t need or care about getting one for other users.
You call Get users without an ID or Login just the Access token and it will return the User for that token
Or you can call the validate endpoint which will validate the token and return the user_id and login for the token. (Easy way to see what kind of token you have as well)
You were right, I forgot to actually set the access token, which is why it was complaining.
I have decided to go a slightly different route as I don’t want to retrieve an access token for every user currently, but I now know what was going wrong and how I can do it this way.
However, the last stumbling block I possibly see is:
I have removed the sensitive information, but as you can see, I requested the additional scopes, but the access token that was returned states that it only has the user:read:email scope? Does that sound right, or is something still going wrong there?
I thought that might be the case. Thank you for your help. I will test it and confirm it with my new flow, but I think this will likely solve my issues.
Confirmed, I now have it working perfectly. Thank you for all the assistance Barry. I should be right to work with the API from here now that I have valid auth flows.