Я всегда получаю следующее исключение, когда при вызове Azure ADB2C с использованием MSAL 2.2.0 ниже приводится фрагмент кода и получено исключение.Обратите внимание, что все пакеты nuget обновлены, и ничего не требуется обновлять. PublicClientApplication PCA = new PublicClientApplication (BL.Constants.ClientID, BL.Constants.Authority);
PCA.RedirectUri = BL.Constants.RedirectUri;
try
{
//IEnumerable<IAccount> accounts = await PCA.GetAccountsAsync();
//var authenticationResult = await PCA.AcquireTokenAsync(BL.Constants.Scopes, new UIParent(this.Activity));
var authenticationResult = await PCA.AcquireTokenAsync(
BL.Constants.Scopes,
"",
UIBehavior.SelectAccount,
"",
null,
BL.Constants.Authority,
new UIParent(this.Activity));
}
catch (MsalException ex)
{
if (ex.Message != null && ex.Message.Contains("AADB2C90118"))
{
//await OnForgotPassword();
}
if (ex.ErrorCode != "authentication_canceled")
{
//await DisplayAlert("An error has occurred", "Exception message: " + ex.Message, "Dismiss");
}
else
{
}
}
catch (Exception ex)
{
string test = ex.Message;
throw ex;
}`
Здесь находится постоянный файл.
namespace BL
{
public class Constants
{
// Replace strings with your own values
// Azure Active Directory B2C
public static readonly string Tenant = "tenantname.onmicrosoft.com"; // Domain/resource name from AD B2C
public static readonly string ClientID = "clientid"; // Application ID from AD B2C
public static readonly string PolicySignUpSignIn = "B2C_1_SiUpIn"; // Policy name from AD B2C
public static readonly string[] Scopes = { "" }; // Leave blank unless additional scopes have been added to AD B2C
public static string AuthorityBase = $"https://login.microsoftonline.com/tfp/{Tenant}/"; // Doesn't require editing
public static string Authority = $"{AuthorityBase}{PolicySignUpSignIn}"; // Doesn't require editing
public static readonly string URLScheme = $"msal{ClientID}"; // Custom Redirect URI from AD B2C (without ://auth/)
public static readonly string RedirectUri = $"{URLScheme}://auth"; // Doesn't require editing
}
}
Но я всегда получаю следующие исключения
10-25 08:43:57.924 I/MonoDroid( 2850): UNHANDLED EXCEPTION:
10-25 08:43:57.936 I/MonoDroid( 2850): System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (A call to SSPI failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
10-25 08:43:57.936 I/MonoDroid( 2850): at /Users/builder/jenkins/workspace/xamarin-android-d15-8/xamarin-android/external/mono/external/boringssl/ssl/handshake_client.c:1132
10-25 08:43:57.936 I/MonoDroid( 2850): at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00038] in :0
10-25 08:43:57.936 I/MonoDroid( 2850): at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status) [0x0003e] in :0 An unhandled exception occured.