Issue with Get Moderators endpoint

I get this error when I want to use the Get Moderators endpoint :

{"error":"Unauthorized","status":401,"message":"Insufficient authorization in token"}

I succeeded to use other endpoints, but I have issues with this one, and in the docs (available below), it says that the query parameter “broadcaster_id” must match the user_id in the auth token.

But in the auth token, there’s no user_id ? My Twitch account id is 90849777 but it doesn’t work

Docs : https://dev.twitch.tv/docs/api/reference#get-moderators

If your token doesn’t have a user id, then that means you used the Client Credentials flow and generated an App token, which isn’t associated with a user and so can’t have the scopes required to access endpoints that require permission from the user.

You need to use the Implicit https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-implicit-code-flow if you’re making requests client-side

or the Auth Code flow https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#oauth-authorization-code-flow if making requests server-side

I’m making requests server-side, I think I already use the Auth Code flow because it works on other endpoints, but it’s especially with Get Moderators…

Here’s an exemple of the token I get

{ access_token: MY_ACCESS_TOKEN,
expires_in: 5696218,
scope: [ 'user:read:email', 'moderation:read' ],
token_type: 'bearer' }

You’re token doesn’t doesn’t have a user id, and the expiration is too long for a token from the Auth Code flow.

Follow the process of one of the auth flows I linked above, and it’ll send you to Twitch where you can accept/deny the permissions being asked for, and the redirect you back to your redirect URI where you can finish the auth process.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.