-
Notifications
You must be signed in to change notification settings - Fork 150
Description
Copilot Usage Confirmation
- I have tried using GitHub Copilot to resolve this issue.
MSAL Version
2.4.1
Description
I'm integrating MSAL native authentication in a React Native iOS app and running into a compile-time error in the MSAL pod’s native-auth Swift files:
Cannot find type 'MSALAccount' in scope
This happens specifically in these files:
MSALNativeAuthSilentTokenProviding.swift
MSALNativeAuthUserAccountResult.swift
Even though I see MSALAccount.h present in Pods/MSAL/MSAL/app-lib, the Swift compiler in the native-auth module can’t access it.
I traced it down to module/header visibility:
MSALAccount is in app-lib, but the native-auth subspec is built in the same target and doesn’t see those internal headers by default.
I confirmed in Xcode that the target for MSAL (which includes the native-auth subspec) doesn’t include app-lib in its header search paths by default.
Attempts to patch via HEADER_SEARCH_PATHS in the Podfile (in post_install) haven’t worked — I never see the patch log indicate “fixed header paths for MSAL-native-auth”, meaning the condition block never runs (likely because native-auth is not a separate target but a subspec).
This seems exacerbated on Xcode 16 / latest Swift toolchains, which are stricter about module boundaries.
Error Details
Pod file tried:
platform :ios, '15.0'
use_frameworks!
use_modular_headers!
target 'MSALNativeAuthIssueDemo' do
# Minimal setup to reproduce the build error
pod 'MSAL'
pod 'MSAL/native-auth'
post_install do |installer|
installer.pods_project.targets.each do |target|
# Try to expose MSAL internal headers
if target.name == 'MSAL'
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited)'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(PODS_ROOT)/MSAL/MSAL/app-lib'
config.build_settings['PUBLIC_HEADERS_FOLDER_PATH'] = '$(TARGET_NAME)/app-lib'
end
puts "Updated MSAL header paths"
end
# Attempt to patch native-auth (fails, because native-auth is not a separate target)
if target.name == 'MSAL-native-auth'
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited)'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(PODS_ROOT)/MSAL/MSAL/app-lib'
end
puts "Fixed header paths for MSAL-native-auth"
end
end
end
end
MSAL Logs
N/A
Reproduction Steps
React Native + iOS pods setup
Podfile includes: pod 'MSAL', pod 'MSAL/native-auth'
Xcode 26 (Swift 5)
Pods/MSAL/MSAL/app-lib/MSALAccount.h exists but not exposed to native-auth Swift files
Expected Behavior
Expose MSALAccount as a public header in the MSAL podspec so that the native-auth subspec can import it automatically
Or adjust module maps so that app-lib is imported into the MSAL umbrella module, and native-auth works under the same module
Regression
No response
Screenshots & Screen Recordings
Additional context
No response