state_mismatch when trying to use ADB2C and iOS platform #4644
Description
Library version used
msal.Xamarin.iOS.4.59.0.0
.NET version
.net 8 and uno platform 5.1.
Scenario
PublicClient - mobile app
Is this a new or an existing app?
This is a new app or experiment
Issue description and reproduction steps
After i am prompted for the login screen on iOS simulator i then submit the login and it fails
Here is the log i get
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - ec95a23b-8e2b-4400-95f8-a75062631c2e] Skipping Instance discovery for B2C authority because it is not supported.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - ec95a23b-8e2b-4400-95f8-a75062631c2e] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z] Found 0 cache accounts and 0 broker accounts
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z] Returning 0 accounts
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] MSAL MSAL.Xamarin.iOS with assembly version '4.59.0.0'. CorrelationId(55167a3b-8b57-4f25-8dfa-7ee76f9945fe)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] === AcquireTokenSilent Parameters ===
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] LoginHint provided: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] Account provided: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] ForceRefresh: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe]
=== Request Data ===
Authority Provided? - True
Scopes - https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] === Token Acquisition (SilentRequest) started:
Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
MSAL: Error False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 55167a3b-8b57-4f25-8dfa-7ee76f9945fe] Exception type: Microsoft.Identity.Client.MsalUiRequiredException
, ErrorCode: user_null
HTTP StatusCode 0
CorrelationId
at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11] MSAL MSAL.Xamarin.iOS with assembly version '4.59.0.0'. CorrelationId(3f8a288f-5fad-455b-9aec-9e1b5b14ee11)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11] === InteractiveParameters Data ===
LoginHint provided: False
User provided: False
UseEmbeddedWebView: Embedded
ExtraScopesToConsent:
Prompt: not_specified
HasCustomWebUi: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11]
=== Request Data ===
Authority Provided? - True
Scopes - https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenInteractive
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11] === Token Acquisition (InteractiveRequest) started:
Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:02Z - 3f8a288f-5fad-455b-9aec-9e1b5b14ee11] Starting the iOS embedded webui. Redirect URI: msauth.com.ziidmsapp.ziidmsapp://auth/
Windows.UI.UIFontHelper: Warning: Failed to get system font based on Segoe UI
Thread started: [email protected] Timer
Thread started: 13074243584@
Thread started: [email protected] TP Gate
Thread started: 13076627456@
Thread started: 13068906496@
Thread finished: 13074243584@
Thread finished: 13076627456@
Uno.Toolkit.UI.NativeFramePresenter: Error: Can't process WillShowViewController because of an unsupported native operation.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - f9900459-f5ff-4db7-8636-29380e7b5eb2] Skipping Instance discovery for B2C authority because it is not supported.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - f9900459-f5ff-4db7-8636-29380e7b5eb2] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z] Found 0 cache accounts and 0 broker accounts
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z] Returning 0 accounts
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] MSAL MSAL.Xamarin.iOS with assembly version '4.59.0.0'. CorrelationId(240dce0a-2918-4c81-9773-baec04e4eb9d)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] === AcquireTokenSilent Parameters ===
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] LoginHint provided: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] Account provided: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] ForceRefresh: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d]
=== Request Data ===
Authority Provided? - True
Scopes - https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 240dce0a-2918-4c81-9773-baec04e4eb9d
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] === Token Acquisition (SilentRequest) started:
Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
MSAL: Error False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 240dce0a-2918-4c81-9773-baec04e4eb9d] Exception type: Microsoft.Identity.Client.MsalUiRequiredException
, ErrorCode: user_null
HTTP StatusCode 0
CorrelationId
at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] MSAL MSAL.Xamarin.iOS with assembly version '4.59.0.0'. CorrelationId(90780958-8c9f-46e9-923c-e6d3d3e53d99)
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] === InteractiveParameters Data ===
LoginHint provided: False
User provided: False
UseEmbeddedWebView: Embedded
ExtraScopesToConsent:
Prompt: not_specified
HasCustomWebUi: False
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99]
=== Request Data ===
Authority Provided? - True
Scopes - https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenInteractive
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 90780958-8c9f-46e9-923c-e6d3d3e53d99
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] === Token Acquisition (InteractiveRequest) started:
Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] Starting the iOS embedded webui. Redirect URI: msauth.com.ziidmsapp.ziidmsapp://auth/
Thread started: 13074243584@
Thread started: 13076627456@
MSAL: Error False MSAL 4.59.0.0 MSAL.Xamarin.iOS .NET 8.0.1 17.2 [2024-02-22 06:31:25Z - 90780958-8c9f-46e9-923c-e6d3d3e53d99] Exception type: Microsoft.Identity.Client.MsalClientException
, ErrorCode: state_mismatch
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.VerifyAuthorizationResult(AuthorizationResult authorizationResult, String originalState)
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceInternalAsync(IWebUI webUi, CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
Relevant code snippets
No response
Expected behavior
Shoud return the token if successful login
Identity provider
Azure B2C Custom Policy
Regression
No response
Solution and workarounds
none