MSAL iOS authentification & web SSO (SAML) in Safari not working

Maxime D 0 Reputation points
2023-03-27T14:45:27.7133333+00:00

Hi,

We have integrated the MSAL library into our native iOS and Android applications, and want to reuse the login information in web authentication (SAML).

On Android, when you connect to the native application via MSAL and then go to the website (https://samltestapp2.azurewebsites.net/SP) , we are automatically authenticated, which is the expected behavior.

On iOS, when you connect to the application and then launch Safari, authentication is requested again when it should reuse the information entered on the application.

We have also tested with the "B2C Sample for Apple iOS in Swift" and the problem is also present. How to have a connection in the iOS application that can be reused by Safari?

Thanks for your help

Maxime

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
{count} votes

1 answer

Sort by: Most helpful
  1. Akshay-MSFT 17,961 Reputation points Microsoft Employee Moderator
    2023-03-29T09:58:03.64+00:00

    @Maxime D

    Thank you for posting your query on Microsoft Q&A.

    Web browsers are required for interactive authentication. By default, the MSAL library uses the system web view. During sign-in, the MSAL library pops up the iOS system web view with the Azure AD B2C user interface.

    In the Customize browsers and WebViews for iOS/macOS article this could be due to Cookie sharing and SSO implications

    User's image

    For SSO to work on iOS, tokens need to be shared between apps. This requires a token cache, or broker application, such as Microsoft Authenticator for iOS.

    However in case of android SSO implications By default, applications integrated with MSAL use the system browser's Custom Tabs to authorize. Unlike WebViews, Custom Tabs share a cookie jar with the default system browser enabling fewer sign-ins with web or other native apps that have integrated with Custom Tabs.

    Action Plan: Kindly validate if you are using SFSafariViewController or ASWebAuthenticationSession (Note: SFAuthenticationSession has been deprecated by Apple)

    Thanks,

    Akshay Kaushik

    Please "Accept the answer" (Yes/No), and share your feedback if the suggestion works as per your business need. This will help us and others in the community as well.


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.