Additional Microsoft Entra services and features related to identity, access, and network security
MSAL for iOS does support universal links as a redirect URI.
Key points:
- The default and recommended MSAL redirect URI format for most apps is
msauth.[Your_Bundle_Id]://auth. - That default format is used for most scenarios, including brokered authentication and system web view.
- If universal links are used as the redirect URI, the scheme must be
https. - For universal links, the scheme does not need to be declared in
CFBundleURLSchemes. Instead, the app and domain must be configured per Apple’s universal link requirements. - The app must still call
MSALPublicClientApplication.handleMSALResponsewhen opened through the universal link.
For the security finding, the supported position from the documentation is:
- Custom URL schemes are the default MSAL approach and are the recommended format for most apps.
- Universal links are supported by MSAL for cases where a different redirect URI is needed.
- If the goal is to reduce the risk associated with custom URL scheme collisions, moving to an
httpsuniversal link redirect URI is the MSAL-supported option.
Implementation guidance:
- If brokered authentication with Microsoft Authenticator is required, the documented broker-compatible redirect URI format is
msauth.<app.bundle.id>://auth, and the app should addmsauthv2andmsauthv3underLSApplicationQueriesSchemes. - If switching to universal links, configure the redirect URI as
https://..., configure the app/domain for universal links, and keep the MSAL callback handling in the app entry point. - If a custom redirect URI is supplied to MSAL, pass it in
MSALPublicClientApplicationConfig. MSAL validates the redirect URI during initialization and returns an error if it is invalid.
Swift example for a custom redirect URI configuration:
let config = MSALPublicClientApplicationConfig(clientId: "your-client-id",
redirectUri: "your-redirect-uri",
authority: authority)
do {
let application = try MSALPublicClientApplication(configuration: config)
} catch let error as NSError {
}
Swift callback handling:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return MSALPublicClientApplication.handleMSALResponse(url, sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String)
}
Practical conclusion:
- The scan finding is valid as a general iOS custom-scheme concern.
- MSAL does not require staying on custom URL schemes only.
- Universal links are supported by MSAL on iOS/macOS and are the appropriate MSAL-supported alternative when the security review requires avoiding custom URL schemes.
- If broker-based SSO with Microsoft Authenticator is a requirement, the documented broker flow uses the
msauth.<bundle id>://authredirect format.
- Using redirect URIs with the Microsoft Authentication Library (MSAL) for iOS and macOS
- Using redirect URIs with the Microsoft Authentication Library (MSAL) for iOS and macOS
- Using redirect URIs with the Microsoft Authentication Library (MSAL) for iOS and macOS
- Configure SSO on macOS and iOS
- Install MSAL and configure your project to use the library