These are request headers:
let userName = "someUserName"
let password = "aPasswordForSomeUserName"
var headers: HTTPHeaders = [
"Accept": "application/json",
]
if let authorizationHeader = Request.authorizationHeader(user: userName, password: password) {
headers[authorizationHeader.key] = authorizationHeader.value
}
So this is generating Authorization
like this.
Basic aC5paHFoOkulbXKhNpk43A==
(I have modified it for security).
But when I make the same request in Advance Rest Client (a chrome extension). I am seeing this:
Accept: application/json
Authorization: NTLM TlMMTVNTUAADAAAAGAAYAG4AAAAYABgAhgAAAAYABgBAAAAADAAMAEYAAAAcABwAUgPPPAAAAACeAAAAAYIAAEUARwBBAGgALgBzAGgAYQBoAUIOVABHAC4AUSDFGC4ARQBHAEEALgBMAEEAToD38IenExnddmNhyXz+u0cmIHEl/p8P9OWe2rePPsiRkZO1Ne6ZrWxnIxHK1CZcyTU=
Notice, NTLM and Basic in both the generated authorization key for my username and password.
How to do this in iOS (and possibly with Alamofire)?
This also leads to this question I asked previously.
I enhanced the correct answer in this link, and make work of any request sent using Alamofire instead of adding the login for each ViewController: