我正在创建一个SSO外接程序,我调用它只是为了尝试一下(getAccessToken):
async function getUserData() {
try {
let usertokenEncoded = await OfficeRuntime.auth.getAccessToken();
let usertoken = jwt_decode(usertokenEncoded);
console.log(usertoken);
} catch (exception) {
if (exception.code === 13003) {
} else {
console.log(exception);
}
}
}
我收到一个错误,说:
The identity API is not supported for this add-in. 13000
我相信这和我的清单文件有关,我不觉得有什么问题。
我已经把它放在文件的末尾。这是我用过的代码。
<WebApplicationInfo>
<Id>97d836ee-5c77-4707-9d54-be09716fdxxx</Id>
<Resource>api://localhost:3000/97d836ee-5c77-4707-9d54-be09716fdxxx</Resource>
<Scopes>
<Scope>Files.Read.All</Scope>
<Scope>offline_access</Scope>
<Scope>openid</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</OfficeApp>
我看不出有什么问题,但它不喜欢什么。有人能发现这个问题吗?
这是我的办公室客户
以下是XML的一部分:
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_1">
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<FunctionFile resid="Commands.Url"/>
<ExtensionPoint xsi:type="MessageReadCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgReadGroup">
<Label resid="GroupLabel"/>
<Control xsi:type="Button" id="msgReadOpenPaneButton">
<Label resid="TaskpaneButton.Label"/>
<Supertip>
<Title resid="TaskpaneButton.Label"/>
<Description resid="TaskpaneButton.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="Taskpane.Url"/>
</Action>
</Control>
<Control xsi:type="Button" id="ActionButton">
<Label resid="ActionButton.Label"/>
<Supertip>
<Title resid="ActionButton.Label"/>
<Description resid="ActionButton.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>action</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GroupLabel" DefaultValue="Contoso Add-in"/>
<bt:String id="TaskpaneButton.Label" DefaultValue="Show Taskpane"/>
<bt:String id="ActionButton.Label" DefaultValue="Perform an action"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Opens a pane displaying all available properties."/>
<bt:String id="ActionButton.Tooltip" DefaultValue="Perform an action when clicked."/>
</bt:LongStrings>
</Resources>
<WebApplicationInfo>
<Id>97d836ee-5c77-4707-9d54-be09716fxxxx</Id>
<Resource>api://localhost:3000/97d836ee-5c77-4707-9d54-be09716fxxxx</Resource>
<Scopes>
<Scope>Files.Read</Scope>
<Scope>openid</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>
我还添加了这段代码,以检查我的客户端是否为IdentityAPI设置了需求,并且它有:
function IsIdentitySupported() {
if (Office.context.requirements.isSetSupported("IdentityAPI", "1.3")) {
console.log("Supported");
}
else {
// Provide alternate flow/logic.
}
}
刚将我的代码添加到React中的一个按钮中,它仍然会返回:
顺便提一句--这在网络上的outlook上也是失败的,完全相同的错误。
当我用Yoman创建另一个项目,然后使用configure命令时,我得到:
Error: Unable to set tenant reply urls.
ERROR: Bad Request({"error":{"code":"Request_BadRequest","message":"Invalid object identifier 'undefined'.","innerError":{"date":"2022-10-12T07:00:11","request-id":"972a0b4e-2691-4fe7-a8c6-1f247c2333f5","client-request-id":"972a0b4e-2691-4fe7-a8c6-1f247c2333f5"}}})
发布于 2022-10-11 20:57:00
指定的Outlook版本应该支持Identity API 1.3需求集。有关所有支持的版本,请参见Outlook客户端支持。
您还可以找到更新历史页面中列出的Outlook版本。
尝试构建一个新的外接程序项目,然后使用configure-sso
包将其配置为使用SSO,如单点登录(SSO)快速启动中所述。
https://stackoverflow.com/questions/74019738
复制相似问题