无效的委托令牌。指定了无效的国家/地区云ID(1)

时间:2018-02-08 06:52:16

标签: azure oauth-2.0 office365 azure-active-directory

我们有一个O365租户,一切都是开箱即用的配置。租户被置于德国云中而不是全球(office.de)。 我们还开发了一个Office加载项,用于授权使用OAuth 2.0访问sharepoint。 首先,我们向此网址发起代码请求:

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

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

  

{     "错误":" invalid_grant",     " error_description":" AADSTS90051:无效的委托令牌。指定了无效的国家/地区云ID(1)。\ r \ nTrace ID:52f8aa2b-9f98-4ba6-b778-c0ba484a3c00 \ r \ n相关ID:67100192-82c8-41ea-a5ca-fd9872caaf2e \ r \ n时间戳:2018-02-08 06:31:18Z&#34 ;,     " error_codes":[       90051     ]     " timestamp":" 2018-02-08 06:31:18Z",     " trace_id":" 52f8aa2b-9f98-4ba6-b778-c0ba484a3c00",     " correlation_id":" 67100192-82c8-41ea-a5ca-fd9872caaf2e"   }

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

时,会发生同样的错误

1 个答案:

答案 0 :(得分:0)

我认为你可以使用客户端crendetials流程来实现这一目标:

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

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.使用头部中的访问令牌并使用Office Discovery API:

enter image description here

其他:如果您想获得id_token并使用它,请尝试在请求中使用https://login.microsoftonline.de作为AAD Athorization端点。我没有测试,但它应该可以工作。

希望这有帮助!

相关问题