Skip to content

Microsoft Authenticator broker will not be used in iOS no matter what #2344

@FatherNelson

Description

@FatherNelson

I believe I have uncovered a potential bug in the code tagged with release version 1.5.0 which is currently being used by the MSAL pod on cocoapods. I am not an objective-c developer, but I have been debugging my own mobile app (being built using cordova for access to things like the MSAL plugin) for a couple weeks now and I think I finally found a potential issue in the file MSALPublicClientApplication.m:1109.

Basically I noticed when turning on verbose logging in my app and connecting it up to Safari to be inspected with devtools, the app is throwing the following log message every time regardless of the target ios SDK that I am supplying to the build service:

Requiring default broker type due to app being built with iOS 13 SDK

Line 1109 in the MSALPublicClientApplication.m file is the only place in the codebase this message appears. It also appears that the precompiler condition that wraps the code is as follows:

#if TARGET_OS_IPHONE
    MSIDBrokerProtocolType brokerProtocol = MSIDBrokerProtocolTypeCustomScheme;
    MSIDRequiredBrokerType requiredBrokerType = MSIDRequiredBrokerTypeWithV2Support;
    
    requiredBrokerType = MSIDRequiredBrokerTypeWithNonceSupport;
    MSID_LOG_WITH_CTX(MSIDLogLevelInfo, nil, @"Requiring default broker type due to app being built with iOS 13 SDK");
    
    if ([self.internalConfig.verifiedRedirectUri.url.absoluteString hasPrefix:@"https"])
    {
        brokerProtocol = MSIDBrokerProtocolTypeUniversalLink;
    }
    
    brokerOptions = [[MSIDBrokerInvocationOptions alloc] initWithRequiredBrokerType:requiredBrokerType
                                                                       protocolType:brokerProtocol
                                                                  aadRequestVersion:MSIDBrokerAADRequestVersionV2];

#endif

As far as I can tell from documentation, this condition will always be true on all ios builds, not just builds where the SDK version is 13. I am not necessarily qualified to be making this observation, but it really does seem suspicious. I am hoping someone can take a look at this and fix it if it is indeed the source of my problems with getting the auth broker to fire in iOS.

If not, I am hoping someone here can maybe tell me what I am doing incorrectly to be getting this error message regardless of the build sdk I am using.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions