gpt4 book ai didi

javascript - Outlook WEB 加载项执行 getAccessToken 返回状态代码 302

转载 作者:行者123 更新时间:2023-12-03 04:19:06 26 4
gpt4 key购买 nike

我严格遵守this article构建 Outlook WEB 插件,但是当我执行 getAccessToken 时我收到 302:

Missing grant for this add-in.

姓名:

Preauthorization missing

这是为什么呢?我的加载项已在 portal 中正确注册。我还需要做其他事情吗?此请求的资助类型是什么?我应该将其放在哪里?

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

这是我的 list :

<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.3">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
...
</Host>
</Hosts>

<Resources>
...
</Resources>

<WebApplicationInfo>
<Id>94x668mb-461c-4r4e-851n-fb9721222e31</Id>
<Resource>api://localhost:44374/94x668mb-461c-4r4e-851n-fb9721222e31</Resource>
<Scopes>
<Scope>profile</Scope>
<Scope>user.read</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>

我找到了troubleshooting page对于错误 13005,建议执行以下操作:

13005 Invalid Grant. This usually means that Office has not been pre-authorized to the add-in's web service. For more information, see Create the service application and Register the add-in with Azure AD v2.0 endpoint (ASP.NET) or Register the add-in with Azure AD v2.0 endpoint (Node JS). This also may happen if the user has not granted your service application permissions to their profile.

这是什么意思?

在我请求访问 token 之前,我是否应该同意以下 this documentation ,只需导航到下面的 URL?

https://login.microsoftonline.com/common/adminconsent?client_id=94x668mb-461c-4r4e-851n-fb9721222e31

最佳答案

是的。开发时,您必须按照描述授予管理员同意here

您收到该错误的另一种可能是您没有向该插件预授权 Outlook。当您使用 AAD 2.0 注册加载项时,请确保您已完成本文的步骤 10: Register SSO add-in with AAD 2.0 。最后,如果您还没有查看本文,了解适用于 Outlook 插件的任何特殊因素:Authenticate (Outlook) user with an SSO token

关于javascript - Outlook WEB 加载项执行 getAccessToken 返回状态代码 302,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50676796/

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