Callback URL problems when trying to subscribe with EventSub

TL;DR: Subscribing to a channel with this callback url https://website:8080 gives this: callback must provide valid https callback with standard port in creation request. Why?
[TLDR ends here]

My headers are {“Authorization”: “Bearer app token duh”, “Client-Id”: “my id”}

My data is
{“type”: “stream.online”,
“version”: “1”,
“condition”: {“broadcaster_user_id”: user_data[“data”][0][“id”]},
“transport”: {“method”: “webhook”, “callback”: “https://website:8080”, “secret”: “secret duh”}}

But whenever I try to run my code with this,
async with aiohttp.ClientSession() as session:
async with session.post(“https://api.twitch.tv/helix/eventsub/subscriptions”, json=data, headers=headers) as resp:
print(await resp.json())

I just get status 400 with the message ‘callback must provide valid https callback with standard port in creation request’.

In the twitch dev console, my OAuth Redirect URL is https://website:8080 if that matters. My callback server is listening at http://localhost:8080, and when I use the twitch CLI to test it it works fine.

Is there anything wrong with my callback url?

If there is any other information required, just ask!

Eventsub only supports HTTPS on port 443 only.

So thats your issue is trying to use a non standard port, as the error says

Port 8080 is not the SSL port.

ah, thank you! so everything to do with my callback url would be changed to port 443?

also one more question: for my oauth redirect url, it doesn’t include the port right?

The oAuth redirect URL isn’t used here for eventsub. It’s for oAuth.

EventSub will use the callback your specify. When you attempt to make a subscription.

Generlaly speaking your should run SSL on 443 and only 443 for user trust.

Thank you!

Problem: Error: listen EACCES: permission denied 0.0.0.0:443 when I try to run the server on port 443

443 is a priviledged port, so normally requires sudo (on linux)

Generally people will put services behind web server software such as nginx.

ah. I see. Just ran it with sudo, works perfectly! Thanks!

because I’m already here I might as well just ask another maybe related problem;

Testing it with twitch event verify-subscription subscribe -F http://localhost:8080/eventsub/ -s 5f1a6e7cd2e7137ccf9e15b2f43fe63949eb84b1db83c1d5a867dc93429de4e4

gives this: invalid content-type header. Received type text/html with charset utf-8. Expecting test/plain.

this states your server send HTML instead of plain text

Weird. As of right now i’m just using twitch’s example callback server, so it’s kinda strange.

That would suggest the call never got to your script.

Whats the full output from the Twitch CLI?

Or you can update your script to force set the content type.

If you got a 5xx or a 4xx that can return a text/html Or if you are behind cloudflare cloudflare may have interferred.

Personally I use twitch_misc/receive.js at main · BarryCarlyon/twitch_misc · GitHub

But you can do

res.setHeader('content-type', 'text/plain');
res.send(encodeURIComponent(req.body.challenge));

To force set the content type, but if you got text/html with a charset suggest something else might be going on

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