参考:
https://blog.csdn.net/qq_36437991/article/details/136255926
前端提交给服务端生成token并返回
1 思路:
根据官方文档,生成token的内容(即document,editorConfig这些页面上的json格式代码)要在前端一起打包通过body发送到服务端,服务端收到json数据,golang语言需要解析为结构体,然后将结构体作为“荷载”payload ,生成token,官方的说明:https://api.onlyoffice.com/docs/docs-api/additional-api/signature/browser/
The payload for the JWT token in the JSON format must have the same structure as the config.
Please note that starting from version 7.1, the parameter list to be signed will be strictly regulated. Don’t forget to add all the parameters listed below to your signature.
2 前端:
页面代码中的{{}}是beego框架下golang服务端传递给页面的变量。这些怎么弄,见我的开源代码吧
3 服务端:
服务端golang beego框架,配合生成token返回给前端
4 callbackUrl
似乎最后一个关闭编辑后,oo服务器会像文档下载服务器callbackUrl传出token,需要将token解析吗??官方文件:
https://api.onlyoffice.com/docs/docs-api/additional-api/signature/request/token-in-body/
最后编辑:秦晓川 更新时间:2025-04-29 21:27