Check user is moderator or not

Currently I use following endpoint to determine, that user has moderator status on particular channel or not:
https://api.twitch.tv/kraken/users/user_id/chat/channels/channel_id?api_version=5
I know that the kraken v5 api is deprecated, but I didn’t find in the docs what is an equivalent tor the new api.

Does anyone know what is new / official endpoint for this query?

There are two methods

Real the mod badge from chat in real time (great for bot commands)

Or with the broadcasters token you can call “Get Moderators” you will need the moderation:read scope applied to the token https://dev.twitch.tv/docs/api/reference#get-moderators

Thank you! I’ll check it.

I checked this, successfully obtained app access token with moderation:read scope, this is response:

{"access_token":"........","expires_in":4777185,"scope":["moderation:read"],"token_type":"bearer"}

but when I try to read from https://api.twitch.tv/helix/moderation/moderators I get error:

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

You need a user access token.

image

An App Access token doesn’t have a userID as it doesn’t represent a user.

An “App Access Token” is not the broadcasters token

You are right, it needs broadcaster token.

And what about the fist solution? Can I read badges without connecting to a channel?

In order to read from a channel, you must be in that channel. Otherwise you can’t read.

You could also do /mods and parse the response from chat, but again you’d have to /join the channel to do so

But if you are working with a streamer, it’s just easier to get authorization

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