In my case,i install onlyoffice documentserver through docker,which is the latest version. and it run normally, the example is also run normal ,when i follow the steps by the offical website ,and download onlyoffice-vue-demo and the spring example,when i run ‘npm run dev’, it toast the message “The document security token is not correctly formed. Please contact your document server administrator”,i need your help,thanks
this my .vue file
<template>
<DocumentEditor id="docEditor" documentServerUrl="http://192.168.31.64:8099/" :config="config"
:events_onDocumentReady="onDocumentReady" :onLoadComponentError="onLoadComponentError" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { DocumentEditor } from "@onlyoffice/document-editor-vue";
export default defineComponent({
name: 'ExampleComponent',
components: {
DocumentEditor
},
data() {
return {
config: {
document: {
fileType: "docx",
key: "Khirz6zTPdfd7",
title: "Example Document Title.docx",
url: "test.docx"
},
documentType: "word",
token: 'my_jwt_secret',
editorConfig: {
callbackUrl: "https://example.com/url-to-callback.ashx"
}
}
}
},
methods: {
onDocumentReady() {
console.log("Document is loaded");
},
onLoadComponentError(errorCode, errorDescription) {
switch (errorCode) {
case -1: // Unknown error loading component
console.log(errorDescription);
break;
case -2: // Error load DocsAPI from http://documentserver/
console.log(errorDescription);
break;
case -3: // DocsAPI is not defined
console.log(errorDescription);
break;
}
}
},
});
</script>
Almost the same as in the document
local.json from onlyoffice documentserver
{
"services": {
"CoAuthoring": {
"sql": {
"type": "postgres",
"dbHost": "localhost",
"dbPort": "5432",
"dbName": "onlyoffice",
"dbUser": "onlyoffice",
"dbPass": "onlyoffice"
},
"token": {
"enable": {
"request": {
"inbox": true,
"outbox": true
},
"browser": true
},
"inbox": {
"header": "Authorization",
"inBody": true
},
"outbox": {
"header": "Authorization",
"inBody": true
}
},
"secret": {
"inbox": {
"string": "my_jwt_secret"
},
"outbox": {
"string": "my_jwt_secret"
},
"session": {
"string": "my_jwt_secret"
}
}
}
},
"rabbitmq": {
"url": "amqp://guest:guest@localhost"
},
"wopi": {
"enable": false,
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAg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4GHiA9rPlSdo/iu2kwHAua/pJ
YmG00FY5vYVhm+fNuSCNz\nKetddvMJcykaomDayIH8Le8B/mfK988AwRd00aQvGbJA9N3+euA+i9UdQ8sAXhib\n1RrvPkrZZoln+jGViVyczP4=\n-----END
PRIVATE KEY-----\n",
"publicKey": "BgIAAACkAABSU0ExAAgAAAEAAQCJbNk7j4iAqHDRFXZwwYZPfdxhU6mf3srWwnMuniRKGfN7PVeu3JaoIukLLx4HtR59mJNeF2QtW8mWSx
rcx255BED/ZoHz+YLWlvj1JEUiNKO8/fH+aeFAiXOP0DWz7/0nOPrvm8J+8vKmG+QEianlC7zludc+FvYTwfwdEjuhhEBSVYhy8OwaI/+tImNrSttBmK4mn2+384
R/4TYTykE6AaPeONmOjCBNlmfB9U3HAeqfkmpYue8xDBGuwh71tlmJQn3ly6jYCuWnZK9EkJtPD/riadTF7XTO8uJ1AbnaIsPoIpZUuV5hMGdud4s3k5ycEzgr7I
YVl1nvMLxVApnE",
"publicKeyOld": "BgIAAACkAABSU0ExAAgAAAEAAQCJbNk7j4iAqHDRFXZwwYZPfdxhU6mf3srWwnMuniRKGfN7PVeu3JaoIukLLx4HtR59mJNeF2QtW8m
WSxrcx255BED/ZoHz+YLWlvj1JEUiNKO8/fH+aeFAiXOP0DWz7/0nOPrvm8J+8vKmG+QEianlC7zludc+FvYTwfwdEjuhhEBSVYhy8OwaI/+tImNrSttBmK4mn2+
384R/4TYTykE6AaPeONmOjCBNlmfB9U3HAeqfkmpYue8xDBGuwh71tlmJQn3ly6jYCuWnZK9EkJtPD/riadTF7XTO8uJ1AbnaIsPoIpZUuV5hMGdud4s3k5ycEzg
r7IYVl1nvMLxVApnE",
vH9vKM0IkUk9fiW1oL584Fm/0AEeW7H3BpLlslbLWQXXpOYfR61Bx4vC+kiqJbcrlc9e/MZSiSeLnPC1sren6lTYdx9T4bBcHYV0XCogIiPO9lsiQ==",
"exponent": 65537,
"exponentOld": 65537
},
"storage": {
"fs": {
"secretString": "Lo9Ac3yvIN4XISX1HDlN"
}
}
}
Hello,
You need to form the correct token which you would provide within Editor’s initialization config. Please follow these steps to check:
- In the local.json configuration file (found at /etc/onlyoffice/documentserver inside the Docker container), look for the following:
"secret": {
"inbox": {"string": "yoursecret"},
"outbox": {"string": "yoursecret"},
"session": {"string": "yoursecret"}
}
- You need to generate a token (refer to https://api.onlyoffice.com/editors/security), and sign it using the secret key from the configuration file (refer to https://api.onlyoffice.com/editors/signature/).
- The payload should include the entire editor initialization configuration.
- Pass the generated token as a parameter in the editor initialization configuration (refer to https://api.onlyoffice.com/editors/config/#token)
Browser
Please do according to the above-provided documentation