gpt4 book ai didi

Azure Functions 仅使用 Postman 返回 "401 Unauthorized"

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

我在尝试调用 Azure 函数时遇到一些问题 (code)与 postman 。

我已经设置了 Authentication / Authorizationsettings .

它正在与我的浏览器一起使用(带有登录页面)。

但是当我尝试使用 Postman 时,我收到 401 :

“您无权查看此目录或页面。”

我还尝试使用内置的Postman (see configuration) Oauth2 登录。我可以成功获取tokens (访问和刷新)。但似乎我对函数的 API 请求不起作用...

这是最终的 API 调用:postman screenshot

aad tent_id 以 8d6 开头,应用程序 client_id 以 226 开头,应用 key 以 Av2 结尾。

有什么问题吗...?实际上,Azure Functions 看起来只处理 Cookie 进行身份验证,这就是它与浏览器而不是 Postman 一起使用的原因。如何使其与 header Authorization/Bearer 一起使用?

感谢您的帮助!

最佳答案

您获取访问 token 的方式不正确。就像@Marc所说,在你的 postman 中你没有指定资源或范围。 postman get new access token工具只有scope参数,因此您应该使用v2.0端点来获取访问 token 。

验证网址:

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize

访问 token URL:

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token

范围:

{clientId}/.default

enter image description here

关于Azure Functions 仅使用 Postman 返回 "401 Unauthorized",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57496143/

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