KJ3
KJ3

Reputation: 5298

Twilio Validate Requests from Subaccounts

I want to be able to validate the requests to my server from Twilio are from twilio as shown here. When using my primary account, this works just fine (I use a node wrapper but I manually have followed the steps and can match their x-twilio-signature.

When I use subaccounts, though, it fails every time. I attempt to use the subaccount's auth token as well as the parent's as the key to the SHA, but nothing works, nor do the node wrappers. There is no documentation about subaccounts and validation. Anyone used subaccounts and also tried validating incoming requests?

Upvotes: 1

Views: 325

Answers (1)

Megan Speir
Megan Speir

Reputation: 3811

From a support interaction it looks like the OP spent some time debugging Twilio-Node and found:

The Node module encodes the URL, so it creates something like

https://987f3bb1.ngrok.io/api/twilioWebhook%3Ffoo=1

whereas you guys are not encoding the query string delimiter, so your URL looks like

https://987f3bb1.ngrok.io/api/twilioWebhook?foo=1

I am now recreating the URL myself and passing it in as part of the options, and this does not get formatted so it is working now. I've created an issue in the GitHub repo for this as well with suggestions to fix.

Upvotes: 0

Related Questions