gpt4 book ai didi

azure-active-directory - 办公室插件 Office.context.auth.getAccessTokenAsync 错误 13004

转载 作者:行者123 更新时间:2023-12-01 01:42:41 24 4
gpt4 key购买 nike

我正在构建一个 office.js excel 插件。

我有代码尝试获取身份验证信息:

Office.context.auth.getAccessTokenAsync(function(result) {
if (result.status === "succeeded") {
// Use this token to call Web API
var ssoToken = result.value;
} else {
if (result.error.code === 13003) {
// SSO is not supported for domain user accounts, only
// work or school (Office 365) or Microsoft Account IDs.
} else {
// Handle error
}
}

执行此操作时,我返回错误 13004,并显示消息“name = “Invalid application resource Url provided。”

我的 list 包含:
 <WebApplicationInfo>
<Id>a02210cd-88ac-4af6-b6cf-ee79006731c1</Id>
<Resource>api://localhost:8001/a02210cd-88ac-4af6-b6cf-ee79006731c1</Resource>
</WebApplicationInfo>

</VersionOverrides>

我在以下位置创建了一个插件应用程序注册:
https://portal.azure.com
具有该应用程序 ID(我尝试了“ native ”类型和“网络”类型,不确定哪个适用于办公室插件)。

最佳答案

error code 13004 和消息 Invalid application resource Url provided 指出用于标识 Azure AD 中资源的值与加载项 list 中指定的值之间存在不匹配。

的值<Resource> 加载项 list 中的标记应与 App ID URI 中的值完全匹配在 Azure AD 中注册。唯一的区别是 list 中资源值的协议(protocol)部分将是 api 而不是 https .

所以万一

  • Azure AD 应用注册中的应用 ID URI 为 https://yourdomain.onmicrosoft.com/GUID1
  • 资源值为 api://yourdomain.onmicrosoft.com/GUID1

  • 在加载项身份验证正常工作之前,可能需要解决也可能不需要解决其他问题,因此请注意在执行这些步骤后是否开始收到不同的错误消息。

    以下是来自 Microsoft Docs 和 Github 的一些指导链接,它们对此进行了解释:
  • Troubleshooting Error Messages for SSO in office add-in

    enter image description here
  • Enable Single Sign-on for Office Add-ins

    enter image description here

    enter image description here
  • Register an Office Add-in that uses SSO with the Azure AD v2.0 endpoint

    enter image description here
  • 关于azure-active-directory - 办公室插件 Office.context.auth.getAccessTokenAsync 错误 13004,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54795096/

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