question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Xamarin - AcquireTokenInteractive - NullReferenceException - IOS

See original GitHub issue

Which Version of MSAL are you using ? Microsoft.Identity.Client 4.22.0

Platform Xamarin IOS

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Auth
    • Username Password
    • Device code flow (browserless)

Is this a new or existing app? The app is in production, I haven’t upgraded MSAL, but started seeing this issue

Repro I have a Xamarin IOS app that has been signing into Azure B2C successfully using MSAL 4.8.2. Recently I updated to 4.17.0. Subsequently, I started to receive NullReferenceExceptions when the calling AcquireTokenInteractive when the app is newly installed on a device. I updated to 4.22.0 and the issue remains.

  1. Create a IPublicClientApplication
  2. Attempt to fetch an Access Token using AcquireTokenSilent
  3. Handle MsalUiRequiredException and call AcquireTokenInteractive.
  4. NullReferenceException thrown
  5. Catch and handle NullReferenceException and go back to step 2. The EmbeddedWebUI will now display and the exception will not be thrown.

Any subsequent calls to AcquireTokenInteractive will work without issue. It is only the very first one on a freshly installed app.

Create IPublicClientApplication

            app = PublicClientApplicationBuilder.Create(clientId)
                                                .WithIosKeychainSecurityGroup(appId)
                                                .WithRedirectUri(redirectUri)
                                                .WithB2CAuthority(authority)
                                                .WithLogging(MsalLog, LogLevel.Verbose, false, false)
                                                .Build();

Attempt to fetch an access token

var authResult = await app.AcquireTokenSilent(authConfiguration.Scopes, firstAccount).ExecuteAsync();

MsalUiRequiredException handled

                        var authResult = await app.AcquireTokenInteractive(authConfiguration.Scopes)
                                                    .WithParentActivityOrWindow(parentWindow)
                                                    .WithUseEmbeddedWebView(true)
                                                    .ExecuteAsync();

Exception Stacktrace

  at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI+<>c__DisplayClass10_0.<Authenticate>b__0 () [0x0000b] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Foundation.NSActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSAction.cs:62 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(intptr,intptr,intptr,intptr,bool)
  at Foundation.NSObject.InvokeOnMainThread (System.Action action) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:550 
  at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI.Authenticate (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Internal.RequestContext requestContext) [0x00022] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI.AcquireAuthorizationAsync (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Internal.RequestContext requestContext, System.Threading.CancellationToken cancellationToken) [0x00065] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceInternalAsync (Microsoft.Identity.Client.UI.IWebUI webUi, System.Threading.CancellationToken cancellationToken) [0x00132] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync (System.Threading.CancellationToken cancellationToken) [0x0007d] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync (System.Threading.CancellationToken cancellationToken) [0x00178] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x000fa] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync (System.Threading.CancellationToken cancellationToken) [0x00185] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.ExecuteAsync (Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenCommonParameters commonParameters, Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenInteractiveParameters interactiveParameters, System.Threading.CancellationToken cancellationToken) [0x000d6] in <c223e9e7b5f1456fb506a07d087b55d7>:0 
  at MyCompany.Mobile.Auth.TokenService.SignInAsync () [0x00181] in /Users/patrickdoody/Projects/MyCompany/MyCompany.Mobile/src/MyCompany.Mobile.Auth/TokenService.cs:104 

Expected behavior The embedded WebView displays and the user can input their B2C credentials.

Actual behavior A NullReferenceException is thrown.

Additional context/ Logs / Screenshots 2020-11-10 10:40:36.843170+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Located Container: Prism.DryIoc.PrismContainerExtension 2020-11-10 10:40:36.992863+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MyCompanyMobile:NetworkStateHelper initalised with connected. Resolved pending breakpoint at ‘TokenService.cs:203,1’ to string MyCompany.Mobile.Auth.TokenService.GetUserIdFromToken (string idToken) [0x0000c]. Resolved pending breakpoint at ‘TokenService.cs:219,1’ to string MyCompany.Mobile.Auth.TokenService.GetUserIdFromToken (string idToken) [0x00087]. Thread started: <Thread Pool> #7 Thread started: <Thread Pool> #8 Thread started: <Thread Pool> #9 Thread started: <Thread Pool> #10 Thread started: <Thread Pool> #11 Thread started: <Thread Pool> #12 Thread started: <Thread Pool> #13 Thread started: <Thread Pool> #14 Thread started: <Thread Pool> #15 Thread started: <Thread Pool> #16 Thread started: <Thread Pool> #17 2020-11-10 10:40:37.265784+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121365] Info:DatabaseManager:The database was successfully initialized. 2020-11-10 10:40:37.265929+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121367] Info:DatabaseManager:The database was successfully initialized. Resolved pending breakpoint at ‘TokenService.cs:91,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x000b5]. Resolved pending breakpoint at ‘TokenService.cs:117,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x002ab]. Resolved pending breakpoint at ‘TokenService.cs:131,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x0033b]. Resolved pending breakpoint at ‘TokenService.cs:133,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x00346]. Resolved pending breakpoint at ‘TokenService.cs:138,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x00362]. Resolved pending breakpoint at ‘TokenService.cs:102,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInAsync>d__14.MoveNext () [0x00134]. Resolved pending breakpoint at ‘TokenService.cs:160,1’ to void MyCompany.Mobile.Auth.TokenService.<SignInSilentInternalAsync>d__15.MoveNext () [0x00223]. 2020-11-10 10:40:37.495331+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Verbose:MSAL:Verbose False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - 03d5eb90-5700-4772-a645-035d4799ef46] GetAccounts found 0 RTs and 0 accounts in MSAL cache. 2020-11-10 10:40:37.503823+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - 03d5eb90-5700-4772-a645-035d4799ef46] [Instance Discovery] Skipping Instance discovery for non-AAD authority 2020-11-10 10:40:37.505165+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - 03d5eb90-5700-4772-a645-035d4799ef46] [Instance Discovery] Skipping Instance discovery for non-AAD authority 2020-11-10 10:40:37.506983+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Verbose:MSAL:Verbose False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - 03d5eb90-5700-4772-a645-035d4799ef46] GetAccounts found 0 RTs and 0 accounts in MSAL cache after environment filtering. 2020-11-10 10:40:37.516047+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37] Found 0 cache accounts and 0 broker accounts 2020-11-10 10:40:37.516802+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Verbose:MSAL:Verbose False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37] Returning 0 accounts 2020-11-10 10:40:37.520281+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] MSAL MSAL.Xamarin.iOS with assembly version ‘4.22.0.0’. CorrelationId(f9c33682-cc5d-4147-af6a-f601ca9b2089) 2020-11-10 10:40:37.521408+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] === AcquireTokenSilent Parameters === 2020-11-10 10:40:37.521671+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] LoginHint provided: False 2020-11-10 10:40:37.522023+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] Account provided: False 2020-11-10 10:40:37.522244+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] ForceRefresh: False 2020-11-10 10:40:37.527488+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] === Request Data === Authority Provided? - True Scopes - openid offline_access https://MyCompany.onmicrosoft.com/MyProduct-dev/platform-api/use-data-api https://MyCompany.onmicrosoft.com/MyProduct-dev/platform-api/use-platform-api Extra Query Params Keys (space separated) - ApiId - AcquireTokenSilent IsConfidentialClient - False SendX5C - False LoginHint ? False IsBrokerConfigured - False HomeAccountId - False CorrelationId - f9c33682-cc5d-4147-af6a-f601ca9b2089 2020-11-10 10:40:37.527621+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] 2020-11-10 10:40:37.528161+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] === Token Acquisition (SilentRequest) started: 2020-11-10 10:40:37.531772+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Verbose:MSAL:Verbose False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] No account passed to AcquireTokenSilent 2020-11-10 10:40:37.533146+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Verbose:MSAL:Verbose False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] Token cache could not satisfy silent request 2020-11-10 10:40:37.542250+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Error:MSAL:Error False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:37 - f9c33682-cc5d-4147-af6a-f601ca9b2089] Exception type: Microsoft.Identity.Client.MsalUiRequiredException , ErrorCode: user_null HTTP StatusCode 0 CorrelationId

at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x00180] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x002ed] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync (System.Threading.CancellationToken cancellationToken) [0x000fb] in <c223e9e7b5f1456fb506a07d087b55d7>:0 2020-11-10 10:40:43.383539+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Warn:MyCompanyMobileAuth:Unable to acquire a silent refresh token in TokenService.SignInSilentInternalAsync. 2020-11-10 10:40:43.384417+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Warn:MyCompanyMobileAuth:UI login required. 2020-11-10 10:40:46.886446+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MyCompanyMobileAuth:MsalUiRequiredException occured in TokenService.SignInAsync. Attempting Interactive signin. 2020-11-10 10:40:47.610118+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] MSAL MSAL.Xamarin.iOS with assembly version ‘4.22.0.0’. CorrelationId(02f4d049-22b7-4e21-b936-ad60070f9d7f) 2020-11-10 10:40:47.611803+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] === InteractiveParameters Data === LoginHint provided: False User provided: False UseEmbeddedWebView: Embedded ExtraScopesToConsent: Prompt: not_specified HasCustomWebUi: False 2020-11-10 10:40:47.611936+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] 2020-11-10 10:40:47.613141+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] === Request Data === Authority Provided? - True Scopes - openid offline_access https://MyCompany.onmicrosoft.com/MyProduct-dev/platform-api/use-data-api https://MyCompany.onmicrosoft.com/MyProduct-dev/platform-api/use-platform-api Extra Query Params Keys (space separated) - ApiId - AcquireTokenInteractive IsConfidentialClient - False SendX5C - False LoginHint ? False IsBrokerConfigured - False HomeAccountId - False CorrelationId - 02f4d049-22b7-4e21-b936-ad60070f9d7f 2020-11-10 10:40:47.613257+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] 2020-11-10 10:40:47.613510+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] === Token Acquisition (InteractiveRequest) started: 2020-11-10 10:40:47.616750+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] [Instance Discovery] Skipping Instance discovery for non-AAD authority 2020-11-10 10:40:47.726783+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] Resolving authority endpoints… Already resolved? - FALSE 2020-11-10 10:40:47.953150+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Info:MSAL:Info False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:47 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] Starting the iOS embedded webui. Redirect URI: msauth.com.MyCompany.MyProduct.app-dev://auth/ 2020-11-10 10:40:48.111182+0000 MyCompany.MyProduct.Mobile.App.iOS[38670:2121225] Error:MSAL:Error False (False) MSAL 4.22.0.0 MSAL.Xamarin.iOS 14.0 [11/10/2020 10:40:48 - 02f4d049-22b7-4e21-b936-ad60070f9d7f] Exception type: System.NullReferenceException

at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI+<>c__DisplayClass10_0.<Authenticate>b__0 () [0x0000b] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Foundation.NSActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSAction.cs:62 — End of stack trace from previous location where exception was thrown —

at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(intptr,intptr,intptr,intptr,bool) at Foundation.NSObject.InvokeOnMainThread (System.Action action) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:550 at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI.Authenticate (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Internal.RequestContext requestContext) [0x00022] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Platforms.iOS.EmbeddedWebview.EmbeddedWebUI.AcquireAuthorizationAsync (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Internal.RequestContext requestContext, System.Threading.CancellationToken cancellationToken) [0x00065] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceInternalAsync (Microsoft.Identity.Client.UI.IWebUI webUi, System.Threading.CancellationToken cancellationToken) [0x00132] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync (System.Threading.CancellationToken cancellationToken) [0x0007d] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync (System.Threading.CancellationToken cancellationToken) [0x00178] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x000fa] in <c223e9e7b5f1456fb506a07d087b55d7>:0 at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync (System.Threading.CancellationToken cancellationToken) [0x000fb] in <c223e9e7b5f1456fb506a07d087b55d7>:0 Thread finished: <Thread Pool> #15 Thread finished: <Thread Pool> #10 Thread finished: <Thread Pool> #8 Thread finished: <Thread Pool> #12 Thread finished: <Thread Pool> #11 Thread finished: <Thread Pool> #13 Thread finished: <Thread Pool> #14 Thread finished: <Thread Pool> #17 Thread finished: <Thread Pool> #16 Thread finished: <Thread Pool> #7 Thread finished: <Thread Pool> #9

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:27 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
knashercommented, Mar 4, 2023

I’ve just taken another look at this and can see the issue, I was calling AcquireTokenInteractive as part of the immediate start-up of the application so it tries to launch the web view before it’s ready. Simply sticking to AcquireTokenSilent on start-up and providing users with a button to sign in the event of failure should be what’s needed to get around this problem.

1reaction
mauro-dasilvacommented, Mar 30, 2021

@jennyf19 We are seeing a very similar thing on our side. We using the latest version V4.28.1 and we get the following stack trace as a result

at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI+<>c.<AcquireAuthorizationAsync>b__4_0 () [0x0000a] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Foundation.NSActionDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:62 at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(intptr,intptr,intptr,intptr,bool) at Foundation.NSObject.InvokeOnMainThread (System.Action action) [0x00007] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:550 at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI.AcquireAuthorizationAsync (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Internal.RequestContext requestContext, System.Threading.CancellationToken cancellationToken) [0x00060] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceInternalAsync (Microsoft.Identity.Client.UI.IWebUI webUi, System.Threading.CancellationToken cancellationToken) [0x00132] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync (System.Threading.CancellationToken cancellationToken) [0x0007d] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync (System.Threading.CancellationToken cancellationToken) [0x0017d] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x000fa] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync (System.Threading.CancellationToken cancellationToken) [0x00185] in <b1b1858c130d4f3884734339a9eb3ae8>:0 at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.ExecuteAsync (Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenCommonParameters commonParameters, Microsoft.Identity.Client.ApiConfig.Parameters.AcquireTokenInteractiveParameters interactiveParameters, System.Threading.CancellationToken cancellationToken) [0x000dc] in <b1b1858c130d4f3884734339a9eb3ae8>:0

Do you know what the problem is, or do you need any further information?

Read more comments on GitHub >

github_iconTop Results From Across the Web

xamarin.forms - AcquireToken stop working after some time
I am working in Xamarin forms application. I am using below code snippet to get token for AAD sign-in. IEnumerable<IAccount> accounts = await ......
Read more >
Use brokers with Xamarin iOS & Android - Microsoft Entra
Learn how to setup Xamarin iOS applications that can use the Microsoft Authenticator and the ... On the AcquireTokenInteractive call, use .
Read more >
Using web browsers (MSAL.NET) - Microsoft Entra
Web browsers are required for interactive authentication. By default, MSAL.NET supports the system web browser on Xamarin.iOS and Xamarin.
Read more >
Implementing MSAL authentication in Xamarin.Forms
Handling iOS specifics; Handling Android specifics; Putting it all together; In closing. What is the Microsoft Authentication Library (MSAL)?.
Read more >
Authenticate your Xamarin applications using ...
In this tutorial I'm going to show you how to authenticate your Xamarin applications using the Microsoft authentication system.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found