gpt4 book ai didi

azure - 使用 postman 生成不记名 token

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

我已在 Azure AD 中注册了一个应用程序。我选择支持的帐户类型为“单租户”。我已授予 user.read、openid 和 profile 等权限。

现在,我正在尝试从 Postman 获取访问 token 。我给出了如下参数:

https://login.microsoftonline.com/mytenantid/oauth2/v2.0/token
client_id='myapp client id'
&scope=https://graph.microsoft.com/user.read
&redirect_uri=http://localhost
&grant_type=authorization_code
&client_secret='myapp client secret'

我收到以下错误:

AADSTS900144: The request body must contain the following parameter: 'code'.\r\nTrace ID: ffa4ba48-3287-4615-b6a3-aa71ed757400\r\nCorrelation ID: b375f781-2486-40d4-adee-826b9dc440ec\r\nTimestamp: 2022-04-21 12:13:10Z",

我不明白要提供什么代码以及如何查找代码值。谁能帮帮我吗?

提前致谢。

最佳答案

要解决该错误,您必须在 Postman 中包含代码参数。

要获取该值,请尝试形成一个授权网址,如下所示:

https://login.microsoftonline.com/yourtenantid/oauth2/v2.0/authorize?client_id=yourclientid&response_type=code&redirect_uri=http://localhost&response_mode=query&scope=https://graph.microsoft.com/user.Read&state=skip_get_token2

并在浏览器中打开上述链接。在地址栏中您将获得代码的值。

Image

复制该代码值并在 postman 中添加该参数。

注意,该代码值只能使用一次。要再次获取代码值,您必须再次重复上述过程。

我在我的环境中尝试过,添加code参数后,成功获取了访问 token :

enter image description here

欲了解更多详情,请引用以下链接:

Microsoft identity platform and OAuth 2.0 authorization code flow - Microsoft identity platform | Microsoft Docs .

关于azure - 使用 postman 生成不记名 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72017597/

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