Stream Markers Error

Hello, semi new user here hoping someone might be able to help.

I have the below as a batch file. However it returns {“error”:“Unauthorized”,“status”:401,“message”:“Must provide a valid Client-ID or OAuth token”}

curl -H “Authorization: Bearer [Access Token]” -X POST “https://api.twitch.tv/helix/streams/markers” -H ‘Content-Type: application/json’ -d '{“user_id”:“darklytetv”, “description”:“hello, this is a marker!”}"

I created an application at https://glass.twitch.tv/console/apps/create using category “application” and entered the Client ID in the above where it has [Access Token].

Any help is appreciated!

A client ID is not an access token, it’s just the ID for your app.

Also, as per the documentation for that endpoint you need authentication with the user:edit:broadcast scope, which means a Client ID wont be sufficient for using that endpoint, you need to go through the authentication process and have a user grant your app a user access token with that scope.

Based on this https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#oauth-implicit-code-flow, does this mean anytime I execute the batch file I will be redirect to an OAuth webpage to login and authorize?

My goal is to create a batch file I can run to place a stream marker while I am live without having to leave the game.

You’ll have to be redirected to Twitch’s auth page and redirected back to your app at least once to grant your app the token. With the implicit code flow you’ll have to do this each time the token expires. If you use the Authorization Code Flow you’ll get a refresh token, which you can use to refresh tokens when they expire.

So what you could do is go through the auth process once using the authorization code flow, and then the batch file you plan to use would need to refresh the token if it’s expired before trying to create a marker but this can be done without needing user interaction as you would have already connected the app to your account.

oh dear now I am out of my depth haha :sweat_smile:

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