首页 > 解决方案 > ADAL 节点:未找到租户组织

问题描述

如果授权 url 类似于 https://login.microsoftonline.com/domainName(其中域名是与您的租户关联的域),我会收到以下错误

获取令牌请求返回 http 错误:400 和服务器响应:错误描述 AADSTS90002 未找到租户“组织”如果租户没有活动订阅,则可能会发生这种情况。检查以确保您拥有正确的租户 ID

如果 authority_url 类似于 https://login.microsoftonline.com/{Guid}(其中 Guid 是租户 ID),则代码可以正常工作

示例代码:

var authorityUrl = 'https://login.microsoftonline.com/organizations';
var authContext = new AuthenticationContext(authorityUrl, undefined, undefined, '');
var token = await this.authContext.acquireTokenWithClientCredentials(this.resourceId, this.clientId, this.clientSecret);

使用“adal-node”:“0.2.1”

标签: node.jstypescriptazure-active-directoryadaladal.js

解决方案


错误消息指出您指定的租户(“组织”)不存在。请尝试提供有效的租户名称。
https://login.microsoftonline.com/YourOrgName.onmicrosoft.com,其中“YourOrgName.onmicrosoft.com”应替换为您的租户名称。


推荐阅读