Need dedicated support? Click here
Need dedicated support?
Click here

The document security token is not correctly formed in docker

Hello everyone,

My English is not very good, and this is my first time posting on the forum. I want to deploy OnlyOffice/DocumentServer using Docker. Here is the command I used:

docker run -d -p 8808:80 -e JWT_SECRET=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7ImMiOiJpbmZvIiwia2V5IjoiS2hpcno2elRQZGZkNyJ9fQ.hGQ8kquQWpg4MQYiSYaIzik0wotP1coAop6QfLruenA --name onlyoffice_documentserver onlyoffice/documentserver`

And here is my HTML code:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
 
<body>
<div id="placeholder"></div>
<script type="text/javascript" src="http://192.168.31.158:8808/web-apps/apps/api/documents/api.js"></script>
<script>
 
    var docEditor = new DocsAPI.DocEditor("placeholder", {
        "document": {
            "fileType": "docx",
            "permissions": {
                "edit": false,
            },
            "key": "Khirz6zTPdfd7",
            "title": "zf.docx",
            "url": "file:///C:/Users/MySNN/Desktop/test.docx"
        },
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7ImMiOiJpbmZvIiwia2V5IjoiS2hpcno2elRQZGZkNyJ9fQ.hGQ8kquQWpg4MQYiSYaIzik0wotP1coAop6QfLruenA",
        "height": "1000px",
        "width": "100%"
    })
 
</script>
</body>
</html>

When I run this code in the browser, I get an error saying, “The document security token is not correctly formed.” I understand that this is related to the JWT token, but after checking the relevant documentation, I don’t understand why I’m still encountering this issue even though I’ve added the JWT_SECRET parameter in the Docker startup command and included the token and key in the HTML code.

Thank you.

Hello @ChiMu

Please note that the token parameter sent in the config is not the same thing as a secret of the JWT. Please visit an official JSON Web Token page to learn more about it in general.

As for the usage of JWT on Document Server side check out these articles:
https://api.onlyoffice.com/editors/signature/
https://api.onlyoffice.com/editors/security

If you struggle with making it work, you can alternatively disable JWT. More about how to configure JWT on Document Server side you can find here:
https://helpcenter.onlyoffice.com/installation/docs-configure-jwt.aspx