Microsoft团队选项卡SSO getAuthToken返回resourceDisabled



我在一个多租户团队应用程序中工作,想使用SSO为机器人添加一个选项卡。在我的开发环境中,这一切都很好,我可以毫无问题地登录。当我将其部署到QA环境中时,我会得到以下错误

AUTHMSAL: Event: adal:tokenRenewFailure, code: invalid_resource|AADSTS500011: The resource principal named api://[mydomain]/[myappid] was not found in the tenant named [tenant]. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Trace ID: d9eae514-36e0-4c28-afeb-3312133b0a01
Correlation ID: 82e84904-a4ef-490a-a114-b5efb68eb701
Timestamp: 2021-05-14 15:22:47Z, resource: api://[mydomain]/[myappid], action: resourceDisabled

我不知道为什么会失败。我已经在QA中检查了租户,并确认我的应用程序列在";企业应用程序";,并且许可已得到同意,并已授予管理员同意。我还检查了我的开发环境和qa-env的应用程序注册设置是否有任何差异(除了URI名称(,但没有。

这是我用来尝试检索AuthToken 的代码

const authTokenRequest: microsoftTeams.authentication.AuthTokenRequest = {
successCallback: function (token: string) {
const decoded: { [key: string]: any; } = jwt.decode(token);
localStorage.setItem("name", decoded.name);
localStorage.setItem("token", token);
},
failureCallback: function (error: any) {
console.log("Failure on getAuthToken: " + error);
}
};
microsoftTeams.initialize(() => {
microsoftTeams.getContext((r) => {
microsoftTeams.authentication.getAuthToken(authTokenRequest);
});
});

有人能给我指出正确的方向吗?我哪里错了?

@entropic@Anand@Jagadeesh MSFT

我也遇到过类似的情况,当我测试基于Microsoft提供的示例创建的选项卡应用程序时,从getAuthToken收到resourceDisabled错误Microsoft Teams-标签Azure AD单一登录示例

[img]resourceDisabled从getAuthToken 返回

我所做的是根据以下内容更正webApplicationInfo.resource元素中的AppID清单文件具有不正确的/静态资源url#3

我现在可以得到正确的结果:

[img]getAuthToken现已成功

注意:我还将模式版本从1.5更新到1.9,但这一更改似乎与问题无关。

"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json",
"manifestVersion": "1.9",

最新更新