gpt4 book ai didi

用户注册后的Azure B2C回调: Basic credentials specified for 'PreUserWriteRestful' are invalid

转载 作者:行者123 更新时间:2023-12-03 03:55:02 25 4
gpt4 key购买 nike

我们有 B2C 租户。用户注册后,我们想要设置一些自定义声明。为此,我们要触发 azure 函数。我正在关注this教程。

我的注册政策如下所示: enter image description here

“验证授权码”是API连接: enter image description here

我不明白要提供什么用户名和密码?此外,我不明白如何调用 azure 函数,因为它是通过 AAD 保护的,如下所示: enter image description here

最后,我在注册时遇到了这个错误:

Basic credentials specified for 'PreUserWriteRestful' are invalid. Check that the credentials are correct and that access has been granted by the resource.

azure 函数非常简单(但肯定没有调用它):

/// <summary>
/// API call, that is triggered by a sign-up user flow.
/// </summary>
[FunctionName("ValidateAuthCode")]
public async Task<IActionResult> ValidateAuthCode(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
ClaimsPrincipal principal, ILogger log)
{
foreach (var c in principal.Claims)
{
log.LogInformation($"Claim type: {c.Type} ; claim value: {c.Value}");
}

return new OkObjectResult(new { version = "1.0.0", action = "ShowBlockPage", userMessage = "Auth code issue." });
}

最佳答案

用户名和密码是通过 REST 调用的引用基本身份验证。

"Basic secures the REST API with HTTP basic authentication. Onlyverified users, including Azure AD B2C, can access your API. Theusername and password are stored in Azure AD B2C policy keys. Learnhow to secure your RESTful services by using HTTP basicauthentication."Reference

上面的信息讨论的是自定义策略,但它是特定于协议(protocol)的,因此它仍然与用户流相关。

Azure Functions 支持不同类型的编程语言 - 但通常您需要查找 Web API 的 HTTP 基本身份验证示例。我建议从 Microsoft 的 Web API 文档开始 https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-app-types?toc=/azure/active-directory-b2c/TOC.json&bc=/azure/active-directory-b2c/bread/toc.json#web-apis

从那里,根据您在 Azure Function 中使用的内容找到 Web API 示例。

关于用户注册后的Azure B2C回调: Basic credentials specified for 'PreUserWriteRestful' are invalid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64892169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com