• cnaccio@thehelpdesk.com
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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.