我们有一个Xamarin.Forms应用程序,尝试使用MSAL身份验证,在iOS项目中遇到了问题。它在模拟器中工作正常,但是当通过Azure管道构建并安装在真实的iPhone上时,会出现异常:
MSAL.Xamarin.iOS.4.14.0.MsalClient Exception: ErrorCode: missing_entitlements Microsoft.Identity.Client.MsalClientException: 应用程序在Entitlements.plist中未启用钥匙串访问组。因此,无法保存到iOS钥匙串。钥匙串访问组“OURID.com.microsoft.adalcache”未在Entitlements.plist中启用...
OURID当然是实际值的替代。
以下是我们在entitlements.plist中的内容:
MSAL.Xamarin.iOS.4.14.0.MsalClient Exception: ErrorCode: missing_entitlements Microsoft.Identity.Client.MsalClientException: 应用程序在Entitlements.plist中未启用钥匙串访问组。因此,无法保存到iOS钥匙串。钥匙串访问组“OURID.com.microsoft.adalcache”未在Entitlements.plist中启用...
OURID当然是实际值的替代。
以下是我们在entitlements.plist中的内容:
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
</array>
在B2CAuthenticationService的构造函数中:
var builder = PublicClientApplicationBuilder.Create(B2CConstants.ClientID)
.WithB2CAuthority(B2CConstants.AuthoritySignInSignUp)
.WithIosKeychainSecurityGroup(B2CConstants.IOSKeyChainGroup)
.WithRedirectUri($"msal{B2CConstants.ClientID}://auth");
我可能会漏掉什么导致出现异常?
补充:如果我在管道中添加一个变量替换任务,即使这些任务只能替换xml和json配置文件中的值,也不能替换plist文件。