c# - Blazor 个人帐户失败并显示“ArgumentException:'value' 中的路径必须以'/'开头。(参数'value')”
问题描述
我已经使用 VS2019 社区向导创建了 Blazor 应用程序。我选择了个人帐户并配置如下:
"AzureAdB2C": {
"Instance": "https://my-domain-from-azure.b2clogin.com/tfp/",
"ClientId": "copy-pasted-guid-from-azure-here",
"CallbackPath": "https://localhost:44308/signin-oidc/",
"Domain": "my-domain-from-azure.onmicrosoft.com",
"SignUpSignInPolicyId": "B2C_1_xxxx_signup_signin",
"ResetPasswordPolicyId": "B2C_1_xxxx_password_reset",
"EditProfilePolicyId": "B2C_1_xxxx_edit"
}
下一次启动看起来与启动时完全一样:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(AzureADB2CDefaults.AuthenticationScheme)
.AddAzureADB2C(options => Configuration.Bind("AzureAdB2C", options));
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
这让我发疯,我搜索了 SO,试图从错误处理中删除/添加所有/
内容.json
,.cs
但仍然发生错误。
知道我错过了什么,做错了吗?
解决方案
尝试将您的 CallbackPath 更改为 /signin-oidc - 即相对 url
推荐阅读
- mongodb - 如何在mongodb中构建查询
- android - Android WebView 在呈现最新更新到 v90.0.4430.82 的内容时崩溃
- javascript - 防止 moment.js 接受整数作为有效的 ISO8601 日期
- javascript - 如何在点击时更改按钮颜色?
- json - Django JWT - 向用户添加自定义字段
- python - 如何通过pymongo或其他python工具获取mongodb的版本信息?
- angular - 如何传递在函数中创建的对象?
- sql - 如何使用复杂的 proc SQL 格式化 SAS 脚本
- javascript - 在应用程序中工作时,Jest 中未更新 React 状态
- linux - Linux - 以特殊方式分屏