gpt4 book ai didi

azure - 委托(delegate) token 无效。指定的国家云 ID (1) 无效

转载 作者:行者123 更新时间:2023-12-03 04:21:13 29 4
gpt4 key购买 nike

我们有一个 O365 租户,一切都是开箱即用的。租户放置在德国云中,而不是全局 (office.de) 中。我们还开发了一个 Office 插件,使用 OAuth 2.0 授权访问共享点。首先,我们向此网址发起代码请求:

http://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=client_id&redirect_uri=redirect_uri&state=state

我们得到了所有值,包括代码。然后,我们向发现服务发起请求,以使用以下 url 发现服务:

https://login.windows.net/common/oauth2/token?client_id=client_id&redirect_uri=redirect_uri&resource=https://api.office.com/discovery/&grant_type=authorization_code&code=code

在全局云中一切正常,我们获得了所需的服务列表,但在德国云中我们收到以下错误:

{ "error": "invalid_grant", "error_description": "AADSTS90051: Invalid Delegation Token. Invalid national Cloud ID (1) is specified.\r\nTrace ID: 52f8aa2b-9f98-4ba6-b778-c0ba484a3c00\r\nCorrelation ID: 67100192-82c8-41ea-a5ca-fd9872caaf2e\r\nTimestamp: 2018-02-08 06:31:18Z", "error_codes": [ 90051 ], "timestamp": "2018-02-08 06:31:18Z", "trace_id": "52f8aa2b-9f98-4ba6-b778-c0ba484a3c00", "correlation_id": "67100192-82c8-41ea-a5ca-fd9872caaf2e" }

当我们尝试将 URL 更改为 https://login.windows.de/common/oauth2/token

时,也会发生同样的错误

最佳答案

我认为您可以使用客户端凭据流来实现这一点:

1.请求 Office Discovery 服务 API 的访问 token :

POST https://login.microsoftonline.de/{{yourtenantId}}/oauth2/token?client_id={{client_id}}&client_secret={{client_secret}}&grant_type=client_credentials&resource=https://api.office.com/discovery/

2.使用head中的访问 token 并使用Office Discovery API:

enter image description here

附加:如果您想获取id_token并使用它,请尝试使用https://login.microsoftonline.de作为您请求中的 AAD 授权端点。我没有测试,但应该可以。

希望这有帮助!

关于azure - 委托(delegate) token 无效。指定的国家云 ID (1) 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48679308/

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