根据文档, 在 ONLYOFFICE 文档中打开文件进行编辑时,必须将令牌添加到配置中以验证参数。
我打开一个文件的时候也添加了令牌,如果我使用了错误的秘钥生成令牌,就会提示我需要正确的令牌,说明令牌验证是生效的,但是文档中特别说到了JSON 格式的 JWT 令牌的有效负载必须与config具有相同的结构,然而我发现参数不一致的时候也能打开文件.
重现步骤
1.根据配置生成一个token(下面的代码只是一个大概的示例)
const config = {
document: {
fileType: "xlsx",
isForm: true,
key: "Khirz6zTPdfd7",
referenceData: {
fileKey: "BCFA2CED",
instanceId: "https://example.com",
},
title: "Example Title",
url: "https://example.com/url-to-example-document.xlsx",
}
};
2.然后将document.title的值改成test
3.然后实例化编辑器new DocsAPI.DocEditor(“editor”, config);
因为这时候token里的payload的title的值与config里的title值已经不一致了,理论上不应该能打开编辑器,而实际是可以的,这是正常的行为吗?
Document Server version:9.0
Type of installation of the Document Server (docker, deb/rpm, exe, please point us to the installation guide that you used as well): docker
OS:Windows 11
Browser version:138.0.3351.77