[SOLVED ]401 error when setting required configuration

As the title says, when I try to set required configuration, I get the following error
{"error":"Unauthorized","status":401,"message":"Sorry, you're not allowed to do that"}

My code for the call is:
(entirely on Backend)

 var RCToken = jwt.sign({
					"exp": Date.now() + 2 * 60 * 1000,
					"user_id": MY_ID,
					"role": "external",
			}, EXT_SECRET);

			requestify.put('https://api.twitch.tv/extensions/'+clId+'/0.0.0/required_configuration?channel_id='+chId,{'required_configuration': 'Config'},{
				headers: {
					'Authorization' : 'Bearer ' + RCToken,
					'Client-ID': clId,
					'Content-Type': 'application/json'

Where MY_ID is my personal twitch ID (extension owner)
clId is the client ID (the person who just saved their configurations in extension settings)
chId is the channel Id (for which channel the configuration was saved)

Just as a context, when the Broadcaster save the Extensions settings, I make an HTTP call to backend server, the server gets the configurations (using requestify get and a signed JWT), then see if the configurations are Valid and then it tries to call Set required configuration

Thanks In Advance for any help

I think you are missing the channel_id field on your JWT :smiley:

Also did you base64 decode your secret? or is it just the string pasted from the dev site?


Indeed I decoded with base64 my secret (I also had this problem early on), but after adding channel_id both in the jwt and the request header, the same error occurred. besides that, the documentation on “set requested configuration” doesn’t say what should be in the jwt so I was a bit lost in there. Any other thing that could be making my JWT obsolete?

And I use that same code to generate the token to call the “Get Channel Configuration” Endpoint and it works fine

Solved the issue, I was using Opaque Id insted of my Twitch ID