Я добавил в info.plist Следующий раздел
Код: Выделить всё
CFBundleURLSchemes
msal{app-client-id}
< /code>
Вот как я настраиваю PCA: < /p>
PCA = PublicClientApplicationBuilder
.Create(_settings?.ClientId)
#if IOS
.WithRedirectUri($"msal{client-id}://auth")
.WithIosKeychainSecurityGroup("com.microsoft.adalcache")
#endif
.WithB2CAuthority(_settings?.Authority)
.Build();
< /code>
И вот как я его называю: < /p>
public async Task AcquireTokenInteractiveAsync(string[] scopes)
{
if (PCA == null)
return null;
var accounts = await PCA.GetAccountsAsync(_settings?.PolicySignUpSignIn).ConfigureAwait(false); ;
var account = accounts.FirstOrDefault();
var useEmbeddedWebView = false;
#if ANDROID || IOS
useEmbeddedWebView = true;
#endif
return await PCA.AcquireTokenInteractive(scopes)
.WithB2CAuthority(_settings?.Authority)
.WithAccount(account)
.WithParentActivityOrWindow(PlatformConfig.Instance.ParentWindow)
.WithUseEmbeddedWebView(useEmbeddedWebView)
.ExecuteAsync()
.ConfigureAwait(false);
}
Код: Выделить всё
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
}).ConfigureLifecycleEvents(events =>
{
#if IOS
events.AddiOS(iOS =>
{
iOS.FinishedLaunching((app, args) =>
{
PlatformConfig.Instance.ParentWindow = UIKit.UIApplication.SharedApplication.KeyWindow;
return true;
});
});
#endif
}); ;
Подробнее здесь: https://stackoverflow.com/questions/795 ... al-for-ios