C
C#6mo ago
Skit

✅ WCF Basic Auth works with Windows but not Android Client

These binding settings work with my .net maui windows client but on android i get this response " The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm=""'."
BasicHttpBinding binding = new BasicHttpBinding
{
Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.Transport,
Message = new BasicHttpMessageSecurity()
{
ClientCredentialType = BasicHttpMessageCredentialType.UserName,
},
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.Basic,
ProxyCredentialType = HttpProxyCredentialType.Basic
}
},
AllowCookies = true,
MaxReceivedMessageSize = int.MaxValue,
ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max,
MaxBufferSize = int.MaxValue,
};
BasicHttpBinding binding = new BasicHttpBinding
{
Security = new BasicHttpSecurity
{
Mode = BasicHttpSecurityMode.Transport,
Message = new BasicHttpMessageSecurity()
{
ClientCredentialType = BasicHttpMessageCredentialType.UserName,
},
Transport = new HttpTransportSecurity
{
ClientCredentialType = HttpClientCredentialType.Basic,
ProxyCredentialType = HttpProxyCredentialType.Basic
}
},
AllowCookies = true,
MaxReceivedMessageSize = int.MaxValue,
ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max,
MaxBufferSize = int.MaxValue,
};
I have tried many combinations but nothing seems to work. And on google i don't find anything android related. Anyone got an idea what could be the reason?
2 Replies
Skit
Skit6mo ago
ok, i found the solution. Android uses a different encoding
Denis
Denis6mo ago
Consider closing this thread using /close