Exception in custom Azure User Flows

Emanuel Borsoi 156 Reputation points
2021-03-15T15:07:13.573+00:00

I am trying to custmoize the User Flows (Policies) by changing the Page layout. I followed this example, first putting my html file on a public folder on my webspace, then also setting up the Blob Storare and CORS (Tested with test-cors.org). In both cases, once I set the Custom page URI, when I Run user flow I get the following exception:

ArgumentException: An item with the same key has already been added. Key: MicrosoftIdentityError  
System.Collections.Generic.Dictionary<TKey, TValue>.TryInsert(TKey key, TValue value, InsertionBehavior behavior)  
System.Collections.Generic.Dictionary<TKey, TValue>.Add(TKey key, TValue value)  
Microsoft.AspNetCore.Mvc.ViewFeatures.TempDataDictionary.Add(string key, object value)  
Microsoft.Identity.Web.TempDataLoginErrorAccessor.SetMessage(HttpContext context, string message)  
Microsoft.Identity.Web.AzureADB2COpenIDConnectEventHandlers.OnRemoteFailure(RemoteFailureContext context)  
Microsoft.Identity.Web.MicrosoftIdentityWebAppAuthenticationBuilderExtensions+<>c__DisplayClass5_2+<<AddMicrosoftIdentityWebAppInternal>b__5>d.MoveNext()  
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()  
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)  
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)  

If I load it through my DemoApp I get the following error:

Message contains error: 'server_error', error_description: 'AADB2C90047: The resource 'https://emab2cblobstorage.blob.core.windows.net/root/customize-ui.html' contains script errors preventing it from being loaded. Correlation ID: ba1a35d8-4727-4a2a-b06e-30a5ca7a9ea1 Timestamp: 2021-03-15 13:49:30Z ', error_uri: 'error_uri is null'.  

Don't find any help on the web.

Microsoft Security Microsoft Entra Microsoft Entra External ID
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,866 Reputation points Moderator
    2021-03-16T08:42:00.937+00:00

    Hi @Emanuel Borsoi · Thank you for reaching out.

    Above error occurs due to improper CORS settings configured under storage account where the html file is hosted. You need to configure https://Your_B2C_Tenant.b2clogin.com as Allowed origins. Please refer to below screenshot and update your CORS settings:

    78163-image.png

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.