-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HttpClient with NTLM auth returns 401 Unauthorized with Xamarin.iOS SDK 13.14.1.17 #7770
Comments
Is this the same issue that has affected Xamarin.Android? Android issue: https://developercommunity.visualstudio.com/content/problem/756697/last-visual-studio-update-brakes-ntlm-authenticati.html |
@dfoulk No, the issue that impacts android boils down to the native library that socketshttphandler depends on is not supported on android. |
It looks like this bug has made it to the release version Visual Studio 16.5.0 and Xamarin.iOS and Xamarin.Mac SDK 13.14.1.39 that was just released a few days ago. Is there a known work around for this? |
Seems like the bug made it into VS 16.5. |
Thanks @CerealGuy93 I've been waiting since September for them to fix a similar issue with Android and the same update that fixes Android, this bug comes and affects iOS. Do you know if this has been logged on https://developercommunity.visualstudio.com/ ? |
@BlakeMartin838 @CerealGuy93 Can you try using a .net core sample and see if that works? iOS is using With android, the "fix" was to just enable the old mono handler, which we could also do w/ iOS should this be a hard problem to solve. I doubt that, since iOS was functional from our testing. |
This particular Xamarin application that I am having these issues with is calling custom web services on SharePoint, so I am unable to convert these web services to .net core. I can start rewriting this application to not use SharePoint and use .net core instead if this is the direction of the Xamarin. Is this how I should be thinking about these issues? |
@steveisok i tried it with a .net core application against the same API and the requests are working. |
@CerealGuy93 Thanks. What is your server setup? |
@CerealGuy93 @steveisok , are we talking .net core on the Xamarin side or the server/web service side? |
@BlakeMartin838 I meant to try using a simple .net core client application and see if you're able to authenticate against whatever you have protected. |
@steveisok I am currently working against a mvc api behind an iss with a trusted link on a separate AD server. |
@steveisok Is there anything else you need in order to implement a fix for this for Xamarian.iOS like you did for Xamarin.Android? |
@BlakeMartin838 The android issue was (eventually) clear cut as For ios, we're more or less sharing the same code as .net core and accessing the same library, so I'd like to try and investigate it a bit more. That's why seeing if a .net core client sample (on the mac) works is important. And your server setup as well so that I can try to recreate the same conditions. |
@steveisok We had to roll back from VS 2019 to VS 2017 because of the mono issue. Apple is telling us we wont be able to push our ipa's to the store come April because they aren't on Xamarin.IOS 13 SDK. We can't get on Xamarin.IOS 13 because we need VS 2019. We can't get on VS2019 because of this bug. What can we do? |
Here's the initial workaround we suggested for android: https://github.com/EgorBo/NtlmHttpHandler You could try to adapt that for ios for now. Not sure what would be needed as of yet. |
Or, if you dont know how to make this work here is my workaround: In my case everything is working again, i wont publish my app with this "workaround" but i can develop my app. |
@CerealGuy93 Can you have VS 16.4.X and VS 16.5.X installed on the same machine or are you doing this on two different machines? |
@BlakeMartin838 you can have multiple installations of VS. If you have multiple version you can overview them in your visual studio installer. Just fyi (i didnt know this a few weeks back) you can even install multiple "sub-version" at the same time. If you need a specific 16.4.x version you can find them here "https://docs.microsoft.com/en-us/visualstudio/releases/2019/history". hope this helps |
We've now had issues with NTLM authentication in Xamarin.Forms since October of 2019. Please prioritize this issue. |
@steveisok i think i missunderstood your first request (the sample application in .net Core), i checked the code on Windows with .net core, not on a MAC. Today i tested this code on both platforms:
Its working on Windows 1903 (18362.720), but with macOS Catalina (10.15.3) its returning unauthorized. |
Does anyone have a development environment that still works with Xamarian iOS and NTLM Authentication that I can try to get working on my side? I had VS 16.4.5 and Xamarin.iOS 13.10.0.17 working until last week when the Apple update broke the connection between my PC and Mac (https://developercommunity.visualstudio.com/content/problem/961788/broker-error.html?childToView=971226#comment-971226). Now I can connect to debug on the simulator but when I try to compile a production release I get "dsymutil exited with code 1" |
@CerealGuy93 It would be helpful if you could file an issue in the dotnet runtime repo. Since it fails on .net core too, they own that feature and probably would have a better idea what to do. Describing your server setup in detail will also be important to help us set the same conditions. |
@BlakeMartin838 We have an environment that works currently with Visual Studio 16.3 and .NET Core 3.1. If I were you, I would try installing Visual Studio 16.3 as a second VS2019 install. You may need to roll XCode back to the appropriate version for that version of VS as well. I know- "that is ridiculous", but it's what we have right now- I suppose... BT dubs: We're using NtlmHttpHandler to repair the NTLM client on Android that broke before this did. 😑 My VS2019 Environment
About Microsoft Visual Studio
|
@nwhittle Are iOS builds on your machine still performing NTLM authentication successfully? If so, can you post your environment info here, please? |
@nwhittle hopefully we will see NTLM working properly again in the near future. It sounds like the recommended workarounds are not working in a Xamarin.Forms solution. @steveisok Do you know if anybody is working on fixing this so that we can eliminate these workarounds and get things back to normal? |
@dfoulk The problem w/ iOS does seem like an issue w/ osx in general on .net core. My recommendation was to create an issue there, but since that hasn't happened, then perhaps I could log one. As for android, that is a tougher problem and probably will be addressed in .net 5. |
@nwhittle im glad that the solution works for you. We just published our app with the workaround and so far no reported problems. @steveisok you are right, i totally forgot about the issue for dotnet core. Have your already created a issue or should i still do it? |
AFAIK the NSUrlSessionHandler will correctly deal with NTLM, which is the recommended one on iOS. This is a netcore/mono issue. @steveisok if we have a netcore issue, I would mention it here and would close this one. |
I can confirm that NTLM works with Xamarin.iOS SDK 13.10.0.17 but it is broken with every release after. I testet it in the client project im currently working on. |
Any news on this matter? Can confirm the given workaround with the modified version of EgorBos NtlmHttpHandlerFactory above works in my Xamarin Forms app but this should be fixed for the standard NSUrlSessionHandler! |
Is this still an open issue? I am using an older version of Visual Studio and have turned off all updates for Xcode for iOS and the latest version of Visual Studio for Android. |
Yes, this is still an issue. |
We're impacted by this as well. The workaround is not that simple for us because we use a custom handler that inherits from the default one... is there anyone working on this? |
CerealGuy93's static handler works for US....THANK YOU FOR PROVIDING THIS WORKAROUND. So when is this issue going to be fixed for real...IT HAS BEEN OCCURRING SINCE JANUARY!!! |
@bburtonpa I think we are S.O.L. until (at the earliest) November 2020, when .NET 5 is released. |
For those that are following this thread, IF you are communicating with a Rest service hosted on IIS with Windows Authentication enabled, changing your code to authenticate using BASIC authentication will work. NO changes to IIS will be required other that to enable BASIC authentication. As for the web service, in our case, no changes at all were required to the code. Example:
NOTE: you MAY need to add the domain name to the username: var authData = $"{username}@mydomain.com:{password}"; Hope that helps... |
I was able to confirm that @bburtonpa method works but is using Basic Authentication in an app over HTTPS secure? |
TL;DR Quote from 2014 Microsoft:
Source: https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/basic-authentication A summary of the two authentication methods: Basic NTLM Digest (included due to reference in NTLM explanation above) Digest authentication requires the use of Windows domain accounts. The digest realm is the Windows domain name. Therefore, you cannot use a server running on an operating system that does not support Windows domains, such as Windows XP Home Edition, with Digest authentication. Conversely, when the client runs on an operating system that does not support Windows domains, a domain account must be explicitly specified during the authentication. |
After upgrading from Xamarin iOS 13.10.0.17 to Xamarin iOS 14.6.0.15 we are also experiencing these problems. We have a lot of customers which still use NTLM so this is a major issue for us. The workaround is working for now but we would like to have a long term solution for this (e.g. when Xamarin moves to .NET Core 6.0). I wrote some unittests to reproduce the problem, see: https://github.com/JeroenBer/testntlm. Also I created a new item on dotnet runtime since this also seems like a bug in .NET Core on Mac: dotnet/runtime#46247 What do we need to do to get this solved ? and not a temporary workaround. Also on Android the fix for now is downgrading to MonoWebRequestHandler. |
We still have to use the old version Xamarin iOS 13.10.0.17. Our project contains a large number of methods, that uses HttpClient. Сode of these methods is located in shared project, that uses non only IOS. So we're still hopeful about fixing this issue! |
I do not have an HttpClient so I can't use the HttpClientHandlerFactory to workaround the issue. I am using a WebService from an .asmx file that I add as a WebReference in my Xamarin project. Does anyone have any idea of a workaround? I can't believe this has not been fixed yet... |
Is there any option to downgrade the XamrinIos SDK ? |
I have been avoiding the work arounds assuming there would be a fix for this issue. But with the release of iOS 15, my outdated but working version of the SDK is no longer supported. My users are getting "The developer of this app needs to update it to work with this version of iOS." Is there a generally agreed upon work around that I should try to be able to keep my app working in iOS 15? |
Yes can confirm that #7770 (comment) is still working great for me. Also for iOS 15. I just use the latest Xamarin.ios now |
Blake, I just went through this same drill and found out the hard way that armv7 is no longer supported in iOS 15. For your APP to work, you will need to change the Supported Architectures in Visual Studio to ARM64 ONLY. Don't forget to change UIRequiredDeviceCapabilities in your info.plist file to ARM64 as well. Depending on your version of xcode, you will probably need to change the MinimumOSVersion in your info.plist file to 10.0. I hope that works for you... Barry |
@AhmedAdelGadElkareeem Do you have any solution to fix the error? |
yes , we use custom apis ( .NET apis ) that deal with sharepoint and return
data for mobile application
…On Mon, Mar 27, 2023 at 8:45 AM vinhdp195 ***@***.***> wrote:
@AhmedAdelGadElkareeem <https://github.com/AhmedAdelGadElkareeem> Do you
have any solution to fix the error?
—
Reply to this email directly, view it on GitHub
<#7770 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHHI4NMN5NS55VJADELX2NDW6EZPLANCNFSM4KNBMTDQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Steps to Reproduce
Expected Behavior
Request works in Visual Studio Preview 2 with Xamarin.iOS SDK 13.14.1.17
Actual Behavior
Request returns 401 Unauthorized
Environment
Build Logs
Example Project
Forms.NtlmTest.zip
The text was updated successfully, but these errors were encountered: