要使用 AD B2C 验证 .NET Core 3.0 WPF 桌面客户端,如何使用默认 OS 浏览器?
To authenticate .NET Core 3.0 WPF desktop client with AD B2C, how to use the Default OS Browser?
我正在使用 Microsoft Identity Client (4.0.0)
创建一个新的 WPF .NET Core 3.0 应用程序,并希望使用 AD B2C 进行身份验证以获得对 Web API 的访问权限。
我已经向 AD B2C 租户注册了该应用程序。但是对 AcquireTokenInteractive
的调用抛出一个异常,指示
"Only loopback redirect uri is supported, but
urn:ietf:wg:oauth:2.0:oob was found. Configure http://localhost or
http://localhost:port both during app registration and when you create
the PublicClientApplication object. See
https://aka.ms/msal-net-os-browser for details".
// Creation of PublicClientApp
// Call to WithRedirectUri is commented out because that redirect URI cannot
// be added during app registration.
public static IPublicClientApplication PublicClientApp { get; } = PublicClientApplicationBuilder.
Create(ClientId).
WithB2CAuthority(Authority).
// WithRedirectUri("http://localhost").
Build();
// Sign-in method logic
await App.PublicClientApp.AcquireTokenInteractive(App.ApiScopes).
WithB2CAuthority(App.Authority).
WithPrompt(Prompt.SelectAccount).
ExecuteAsync();
在 AD B2C 应用程序注册中,我无法添加自定义 URI“http://localhost”。不支持这种场景吗?我还可以使用哪些其他选项?
这是本机客户端的 Azure 门户 AD B2C 租户应用程序注册屏幕
Native app registration screen shot
B2C目前不支持这种认证方式。
认证可以参考这个document
我正在使用 Microsoft Identity Client (4.0.0)
创建一个新的 WPF .NET Core 3.0 应用程序,并希望使用 AD B2C 进行身份验证以获得对 Web API 的访问权限。
我已经向 AD B2C 租户注册了该应用程序。但是对 AcquireTokenInteractive
的调用抛出一个异常,指示
"Only loopback redirect uri is supported, but urn:ietf:wg:oauth:2.0:oob was found. Configure http://localhost or http://localhost:port both during app registration and when you create the PublicClientApplication object. See https://aka.ms/msal-net-os-browser for details".
// Creation of PublicClientApp
// Call to WithRedirectUri is commented out because that redirect URI cannot
// be added during app registration.
public static IPublicClientApplication PublicClientApp { get; } = PublicClientApplicationBuilder.
Create(ClientId).
WithB2CAuthority(Authority).
// WithRedirectUri("http://localhost").
Build();
// Sign-in method logic
await App.PublicClientApp.AcquireTokenInteractive(App.ApiScopes).
WithB2CAuthority(App.Authority).
WithPrompt(Prompt.SelectAccount).
ExecuteAsync();
在 AD B2C 应用程序注册中,我无法添加自定义 URI“http://localhost”。不支持这种场景吗?我还可以使用哪些其他选项?
这是本机客户端的 Azure 门户 AD B2C 租户应用程序注册屏幕 Native app registration screen shot
B2C目前不支持这种认证方式。
认证可以参考这个document