function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SteveBowerSteveBower 

Http Request, Authentication Errors

A small note I'll toss up here because I ran into it.  This is just informational.

 

The few lines of sample code for an HttpRequest call using a username/password was nice to have in the documentation.  It was just what I needed, and it was already done for me.  No thinking required.  :-)

 

 

Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' +
EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);

 However, I was integrating with a service which has strictly implemented basic authentication and thus they deny the string "BASIC" and require the string "Basic" which is what I believe is in the Spec: http://tools.ietf.org/html/rfc2617.  Of course they didn't document that anywhere.

 

So, I post this just because if someone else had posted it I wouldn't have wasted an hour making sure every other darn thing was perfect before I figured this out.

 

Hope it helps someone, Steve.

 

 

 

SuperfellSuperfell
Thanks Steve, i'll get the docs updated.
cnaccio@thehelpdesk.comcnaccio@thehelpdesk.com

This was exactly what I needed when trying to consume a SOAP web service without using the WSDL generation tool. Thanks!