gpt4 book ai didi

azure - 从 Azure Functions 请求图形 API

转载 作者:行者123 更新时间:2023-12-02 23:40:37 24 4
gpt4 key购买 nike

我试图了解 Azure Functions 向 Graph API 发出的请求是如何工作的。

从我的 Azure Functions 的应用服务中,我生成了 Active Directory 应用程序,并从那里添加了“API 权限”,以便能够向 Graph API 发出请求。

enter image description here

我的疑问如下:

1- 当我访问 AAD 应用程序的端点 (____.azurewebsites.net/.auth/me) 时,我可以使用它返回的访问 token 向 Graph API 发出请求吗?我已经做了一些测试,但它返回以下错误:CompactToken 解析失败,错误代码:80049217

2-我还尝试向端点发出请求:https://login.microsoftonline.com/[TENANT-ID]/oauth2/v2.0/token这样它应该返回一个访问 token 来向 Graph 的 API 发出请求。但我收到下一个错误:请求正文必须包含以下参数:'grant_type'

为了进行此尝试,我正在使用 Postman/Insomnia。但我不太确定如何继续尝试。

先谢谢了

最佳答案

1- When I access the endpoint of my AAD App(____.azurewebsites.net/.auth/me), could I use the access token thatit returns to make the request to the Graph API?

是的,可以。您需要将["resource=https://graph.microsoft.com"]添加到authsettings下的additionalLoginParams。引用this blog了解更多详情。

enter image description here

2- I have also tried to make a request to the endpoint:https://login.microsoftonline.com/[TENANT-ID]/oauth2/v2.0/token sothat it should return an access token to make the request to the APIof Graph. But I am getting the next error: The request body mustcontain the following parameter: 'grant_type'

调用该端点,需要一些参数,引用this article了解更多详情。

另一件事是,有两种API权限委托(delegate)权限应用程序权限。您应该使用委派权限而不是应用程序权限。

引用:

Difference between Azure App Registration -‘Delegated’ and ‘Application’ Permission

关于azure - 从 Azure Functions 请求图形 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62311983/

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