更新时间:2023-02-16 15:33:51
使用 Microsoft移动应用程序中的身份验证库(MSAL),以与Azure Active Directory B2C租户启动身份验证工作流.
Use the Microsoft Authentication Library (MSAL) in your mobile application to initiate an authentication workflow with your Azure Active Directory B2C tenant.
在iOS平台上,必须修改AppDelegate
类以初始化PlatformParameters
实例,如以下代码示例所示:
On the iOS platform, the AppDelegate
class must be modified to initialize a PlatformParameters
instance, as demonstrated in the following code example:
using Microsoft.Identity.Client;
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
var result = base.FinishedLaunching(app, options);
App.AuthenticationClient.PlatformParameters = new PlatformParameters(UIApplication.SharedApplication.KeyWindow.RootViewController);
return result;
}
}
MSAL使用PlatformParameters
实例来识别其运行所在的平台,以便选择特定于平台的身份验证用户体验和令牌存储机制.
The PlatformParameters
instance is used by MSAL to recognize the platform on which it's running in order to select the platform-specific authentication user experience and token storage mechanism.
有关更多信息,请请参阅文档.