5

Been stuck on this integration problem for hours now. I am trying to subscribe to a youtube channel updates using https://pubsubhubbub.appspot.com/subscribe.

Subscription Request

And my server is setup to respond with:

Server Response

But when I press DO IT, I always get back the error saying Challenge mismatch.

I am unsure which parameter I am missing to set.

Vabs
  • 485
  • 1
  • 5
  • 17

2 Answers2

8

The intended response is not a static value as hub_challenge. It should return back the hub.challenge value which is received in query parameters when GET request is sent to the callback url.

More Information

The request will be something like /notifications?hub.topic=https://www.youtube.com/xml/feeds/videos.xml%3Fchannel_id%3DUCn0QU5ZOaVnEf7LkdyPF9kQ&hub.challenge=216582865281647747&hub.mode=subscribe&hub.lease_seconds=432000"

The response of should be the value hub.challenge (216582865281647747)

Vabs
  • 485
  • 1
  • 5
  • 17
  • 2
    If anyone is doing this with PHP, remember that `hub.challenge` has to be accessed as `hub_challenge` source: https://stackoverflow.com/a/68742/3899623 – Tomás Cot Nov 10 '21 at 23:24
1

Assuming you're using (either directly or indirectly) https://www.npmjs.com/package/body-parser, you could do something like this:

const responseText = request.query['hub.challenge'] || "no challenge" response.send(responseText)

But even if not that exact syntax, figure out how to log the query parameters that the hub adds when hitting the callback URL. There you will see the value for 'hub.challenge' which you can then send back in the response.

timraybould
  • 681
  • 6
  • 9