How to expose NTLM token using URLSession in swift iOS?

How to expose NTLM token using URLSession in swift iOS? If it is not possible using URLSession, do we have any another way to expose it?

Please clarify what you mean by “expose NTLM token”. Are you trying to respond to an NTLM authentication challenge? Or something else?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

In URLSession:task:didReceiveChallenge:completionHandler when I am trying to print headers, I am not getting NTLM token value, I can see only: WWW-Authenticate: NTLM, Negotiate.

However When I hit the API in Insomania/Postman, I can clearly see the NTLM token value along with WWW-Authenticate: NTLM, Negotiate. So I want to capure this hidden token value as well.

So need help how can we capture NTLM token value using URLSession, or do we have any other alternate option to capture it.

For example:

WWW-Authenticate: NTLM TlRMTVN............AAA===

I need the above value.

As per our requirement, we need to pass this token in the next api/webservices. So we need to capture this.

NTLM has always been problematic, not just on iOS but in general. I discuss that in depth here.

One [mis]feature of NTLM is that it authenticates connections, not requests. Thus, for anything to make sense with NTLM you have to implement the session authentication challenge handler (-URLSession:didReceiveChallenge:completionHandler:), not the task one (-URLSession:task:didReceiveChallenge:completionHandler:). Try that to see if it gets you what you need.

Taking a step back, however, my advice is that you move away from NTLM authentication. Notwithstanding its poor security characteristics, it is fundamentally incompatible with modern HTTP best practices (like HTTP/2 and /3).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I tried both delegates and I am unable to capture NTM auth token value. Do we have any other solution or library/framework to capture it.

How to expose NTLM token using URLSession in swift iOS?
 
 
Q