Azure active directory safari redirection issue

Sarah 161 Reputation points
2022-02-14T19:01:09.67+00:00

There is a problem accessing my webapp on iOS(safari and chrome browsers). Works well on android devices(chrome browser) and windows without any redirection problem.

When I use iOS devices, it causes redirection back to login page from home page, after signing in. Like, AAD Login -> Homepage(redirects back to login) -> AAD Login -> Homepage(properly logged in with no further redirection, at this point). It always signs in properly after second sign in, as stated. I would appreciate if anyone could provide input on this.

iOS version:15.2.1 and 15.3.1

Microsoft Security Microsoft Entra Other
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-02-18T02:35:49.59+00:00

    Hi @Sarah

    @Marilee Turscak-MSFT 's comment is correct. And I find a soultion documented by the aspnet/security team on GitHub..

    You can try below methods to solve your issue.

    1. If you are using ASP.NET Core Identity you disable the protection by configuring cookies with the following code

    services.ConfigureExternalCookie(options => {  
        // Other options  
        options.Cookie.SameSite = SameSiteMode.None; }); services.ConfigureApplicationCookie(options => {  
        // Other options  
        options.Cookie.SameSite = SameSiteMode.None; });  
    

    2. If you are using cookie authentication without ASP.NET Core identity you can turn off the protection with the following code

    services.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => {  
        // Other options  
        options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None; })  
    

    3. If you are using external OIDC providers you may be able to avoid the issue by changing the response mode your provider uses from a POST to a GET request, using the following code. Not all providers may support this.

    .AddOpenIdConnect("your_OIDProvider", options => {  
        // Other options  
        options.ResponseType = "code";  
        options.ResponseMode = "query";  
    };  
    

    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Jason


  2. Sechaba Tomodi 1 Reputation point
    2022-04-13T10:06:11.997+00:00

    @Sarah @AmanpreetSingh-MSFT

    Is there a workaround regarding this issue as if affects most companies using Microsoft Product that can be implemented in AD B2C policies and Angular? Any latest update?


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.