You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Why MSAL based iOS app keep asking for login with Microsoft Entra?
3
-
description: Provides guidance for troubleshooting repeated login prompts in iOS MSAL implementation
2
+
title: Why does an MSAL-based iOS app keep asking for credentials with Microsoft Entra?
3
+
description: Provides guidance for troubleshooting repeated sign-in prompts in an iOS MSAL implementation
4
4
ms.date: 03/19/2025
5
5
ms.author: daga
6
6
ms.service: entra-id
7
7
ms.custom: sap:Microsoft Entra App Integration and Development
8
8
---
9
9
10
-
# Troubleshooting login prompt issues in iOS with MSAL SDK
10
+
# Troubleshoot sign-in prompt issues in iOS with MSAL SDK
11
11
12
-
This article provides guidance for troubleshooting repeated login prompts in an iOS app that uses Microsoft Authentication Library (MSAL).
12
+
This article provides guidance for troubleshooting repeated sign-in prompts in an iOS app that uses Microsoft Authentication Library (MSAL).
13
13
14
14
## Symptoms
15
15
16
-
You [integrate Microsoft identity platform authentication](/azure/active-directory/develop/tutorial-v2-ios) in your iOS app by using the Microsoft Authentication Library (MSAL) SDK. However, after the initial login, users are unexpectedly prompted to sign in multiple times.
16
+
You [follow this tutorial](/azure/active-directory/develop/tutorial-v2-ios) to integrate Microsoft identity platform authentication in your iOS app by using the Microsoft Authentication Library (MSAL) SDK. However, after the initial login, users are unexpectedly prompted to sign in multiple times.
17
17
18
18
## Cause
19
19
@@ -23,29 +23,31 @@ The tutorial uses the MSAL to implement authentication. MSAL SDK facilitates aut
23
23
24
24
For SSO to function correctly, tokens must be shared between apps. This requires a token cache or a broker application, such as Microsoft Authenticator for iOS. Interactive authentication in MSAL requires a web browser. On iOS, MSAL uses the system web browser by default for interactive authentication. This default setup supports SSO state sharing between apps.
25
25
26
-
However, if you customize the browser configuration for authentication, such as by using one of the following options, cookie sharing might not be enabled by default:
26
+
However, if you customize the browser configuration for authentication, such as by using one of the following options, cookie sharing might not be enabled by default.
To customize the browser, you must allow cookie sharing to prevent repeated login prompts.
33
32
34
33
## Resolution
35
34
36
-
To enable SSO and cookie sharing between MSAL and your iOS app, use of the following solutions:
35
+
To prevent repeated login prompts, you must allow cookie sharing when you customize the browser. To enable SSO and cookie sharing between MSAL and your iOS app, use one of the following solutions:
37
36
38
-
- Use `ASWebAuthenticationSession` and system Safari browser (`UIApplication.shared.open`)
37
+
- Use `ASWebAuthenticationSession` and the iOS system Safari web browser (`UIApplication.shared.open`)
39
38
40
-
- Use Case: Your app uses MSAL with the default `ASWebAuthenticationSession` instance, and you open external links or logout flows in the system Safari browser.
41
-
- Note: `ASWebAuthenticationSession` is the recommended method for MSAL interactive auth on iOS 12+. It's the only supported method on iOS 13+. It is privacy-preserving and shares cookies with system Safari browser. SSO works between MSAL and system Safari browser because they share cookies through the system authentication session.
39
+
- Use Case: Your app uses MSAL together with the default `ASWebAuthenticationSession` instance, and you open external links or logout flows in Safari.
40
+
41
+
-**Note:**`ASWebAuthenticationSession` is the recommended method for MSAL interactive authentication on iOS 12+. It's the only supported method on iOS 13+. This method is privacy-preserving and shares cookies with Safari. SSO works between MSAL and Safari because they share cookies through the system authentication session.
42
42
- Use `WKWebView`
43
-
- Use Case: You explicitly configure MSAL to use `WKWebView` and your app also uses `WKWebView` for related workflows.
44
-
- Note: If you use `WKWebView` for a consistent experience within your app, note that it is sandboxed and does not share session cookies with Safari or other apps. This supports SSO only within your app.
43
+
- Use Case: You explicitly configure MSAL to use `WKWebView`, and your app also uses `WKWebView` for related workflows.
44
+
45
+
-**Note:** If you use `WKWebView` for a consistent experience within your app, notice that it's sandboxed and does not share session cookies with Safari or other apps. This supports SSO only within your app.
45
46
46
47
For more information, see [Customizing webviews and browsers](/azure/active-directory/develop/customize-webviews).
0 commit comments