【发布时间】:2021-03-05 10:37:20
【问题描述】:
我正在通过身份提供者 Auth0 使用 Azure Web 应用服务。 我得到了这个工作,但是每当我登录托管在 azure 上的网站时,用户配置文件都不会加载到 HttpContext 中。 这在 IIS Express 中本地工作。 知道我可能缺少什么吗?
这是我获取登录用户配置文件的代码:
[Inject]
private IHttpContextAccessor HttpContextAccessor { get; set; }
private string loginId;
/// <summary>
/// On initialized
/// </summary>
/// <returns></returns>
protected override async Task OnInitializedAsync()
{
await LoadInvoiceTypes();
this.loginId = HttpContextAccessor.HttpContext.User.Claims.FirstOrDefault(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;
}
我在网站上做了一些登录,似乎 HttpContext 为空。
提前致谢!
【问题讨论】:
标签: c# azure authentication azure-web-app-service auth0