cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

The Hub is now in read-only mode as we make improvements to the Hub experience. More information is available here.

Push Subscription 400 error

kanoor
Mt. Kenya

Trying to create a push subscription in basic php for authorised users but getting HTTP 400 error

 

Connection #0 to host www.strava.com left intact HTTP Status Code: 400 Error Response Body: Array ( [message] => Bad Request [errors] => Array ( [0] => Array ( [resource] => PushSubscription [field] => bad [code] => request ) ) ) Strava API Response: {"message":"Bad Request","errors":[{"resource":"PushSubscription","field":"bad","code":"request"}]} HTTP Status Code: 400 Error Response Body: Array ( [message] => Bad Request [errors] => Array ( [0] => Array ( [resource] => PushSubscription [field] => bad [code] => request ) ) )

3 REPLIES 3

DBS
Mt. Kenya

Hi,

new day... new attempts... and finally! I managed to solve the problem!

What I changed:

1. On the website https://developers.strava.com/docs/webhooks/, the Example Validation Request I was receiving didn't look like this:

 

https://mycallbackurl.com?hub.verify_token=STRAVA&hub.challenge=15f7d1a91c1f40f8a748fd134752feb3&hub.mode=subscribe

 

but like this:

 

https://mycallbackurl.com?hub_verify_token=STRAVA&hub_challenge=15f7d1a91c1f40f8a748fd134752feb3&hub_mode=subscribe

 

exactly:

hub.verify_token -> hub_verify_token

hub.challenge -> hub_challenge

hub.mode -> hub_mode

2. This is important because during the Subscription Creation Request execution, the Strava server immediately validates my webhook using the Subscription Validation Request, and I hadn't implemented handling for that yet (yesterday).

3. In response to the Subscription Validation Request, even though I received the hub_challenge parameter, I still have to return a JSON response:

 

{"hub.challenge": "XXXXXXXXXXXXXXXXX"}

 

where XXXXXXXXXXXXXXXXX is the string sent by the Strava server via the Subscription Validation Request in the GET parameter hub_challenge.

All of the above changes resulted in success, as I received a Webhook ID from the Strava server, indicating the successful registration of my webhook in Strava.


I hope my notes will help other people who encounter a similar issue. Thanks for your attention, my mistake is resolved.

Best regards!

DBS
Mt. Kenya

Hi, I have the same issue, it seems like an error on Strava's side because I'm executing the command (in the terminal of my website server) exactly the same as on the documentation page https://developers.strava.com/docs/webhooks/

 

 

curl -X POST https://www.strava.com/api/v3/push_subscriptions \
      -F client_id=XXXXXX \
      -F client_secret=YYYYYYYYYYYYYYYYYYYYYYYY \
      -F callback_url=ZZZZZZZZZZZZZ \
      -F verify_token=STRAVA
​

 

where:
XXXXXX - Client ID of my application from https://www.strava.com/settings/api
YYYYYYYYYYYYYYYYYYYYYYYY - Client Secret of my application from https://www.strava.com/settings/api
ZZZZZZZZZZZZZ - callback URL of my website domain provided in the Authorization Callback Domain field during the editing of my application on https://www.strava.com/settings/api

The response I get is:

 

{"message":"Bad Request","errors":[{"resource":"PushSubscription","field":"bad","code":"request"}]}

 

I would greatly appreciate your assistance, Strava Developers.

Thank you!

Did you ever get this fixed?