title: iOS - Alamofire v2 Basic Auth not working
body: <p>So I'm sending a basic auth request to Bing Image Search to grab some image data, and it was working great, right until I updated to the latest version of Alamofire (1.3 -> 2.0.2), which I had to do because 1.3 wasn't even close to compatible with XCode 7.</p>
  
  <p>Anyway, here is my code:</p>
  
  <pre><code>let credentials = ":\(Settings.bingApiKey)"
  let plainText = credentials.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
  let base64 = plainText!.base64EncodedStringWithOptions(NSDataBase64EncodingOptions(rawValue: 0))
  
  manager = Alamofire.Manager.sharedInstance
  manager!.session.configuration.HTTPAdditionalHeaders = [
      "Authorization": "Basic \(base64)"
  ]
  
  let url = NSURL(string: Settings.bingImageApi + "&amp;Query=" + keyword + "&amp;$top=15&amp;$skip=" + String(skip))!
  
  manager!
    .request(.POST, url, parameters: nil, encoding: .JSON)
    .responseJSON { request, response, result in
        ...
  </code></pre>
  
  <p>And I'm getting the error:</p>
  
  <blockquote>
    <p>FAILURE: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.} 
    <strong>The authorization type you provided is not supported.  Only Basic and OAuth are supported</strong></p>
  </blockquote>