Can you post authentication credentials with WebHooks?

102 views
Skip to first unread message

da...@distribion.com

unread,
Apr 26, 2017, 3:44:29 PM4/26/17
to Webhooks

I wrote a Drupal module to post JSON data to ReServe Cloud from our Drupal websites, and now people want me to connect from unbounce landing pages to ReServe using WebHooks.


The problem is, getting the data into Reserve requires authentication, so I do the interaction with cURL like so:

$ch=curl_init();
curl_setopt($ch, CURLOPT_URL,$url);

// Authorization
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
                                           'Content-Length: ' . strlen($data_string)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

$server_output = curl_exec ($ch);
curl_close ($ch);

It looks to me like all I can do with WebHooks is send to a url that doesn't require authentication. Is this correct, or is there some way to send a username/password?


My thinking right now is that I'll have to use the Unbounce WebHooks feature to send data to an app on my server, then send that, with credentials, to ReServe from there. Sure seems like a roundabout way to do it though.


Jeff Lindsay

unread,
Apr 27, 2017, 6:35:09 AM4/27/17
to webh...@googlegroups.com
Webhooks are just HTTP requests. You can authenticate using any and every mechanism you want. It's up to you to communicate what authentication is supported.

--
You received this message because you are subscribed to the Google Groups "Webhooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webhooks+u...@googlegroups.com.
To post to this group, send email to webh...@googlegroups.com.
Visit this group at https://groups.google.com/group/webhooks.
For more options, visit https://groups.google.com/d/optout.
--

da...@distribion.com

unread,
Apr 27, 2017, 10:44:56 AM4/27/17
to Webhooks
Thanks. Unfortunately I've found that the limitation for me is on the posting end. I'm coming in through Unbounce, and they can only post form data, but not authentication. 
Reply all
Reply to author
Forward
0 new messages