Try the fastest and simplest way to install ONLYOFFICE

'Donwload As' Error

Questions/problems on Docker

'Donwload As' Error

Postby Marc » Thu Feb 23, 2017 8:08 am

Hi,
I've already asked this question on Github, but it seems there is more activity here. So I try again :)

I created a docker image for Only Office.
Here is the Dockerfile :

Code: Select all
FROM onlyoffice/documentserver:latest
COPY ./default.json /etc/onlyoffice/documentserver/default.json



The problem is that I get an error when I try to download any document by clicking "Download As". The server send a HTTP 400 error.

I just modified the default.json by adding secret string and enabling token :

Code: Select all
"secret": {
        "inbox": {
          "string": "ABCDEFGHJ",
          "file": "",
          "tenants": {}
        },
        "outbox": {
          "string": "ABCDEFGHJ",
          "file": ""
        },
        "session": {
          "string": "ABCDEFGHJ",
          "file": ""
        }
      },
      "token": {
        "enable": {
          "browser": true,
          "request": {
            "inbox": true,
            "outbox": true
          }
        },
        "inbox": {
          "header": "Authorization",
          "prefix": "Bearer "
        },
        "outbox": {
          "header": "Authorization",
          "prefix": "Bearer ",
          "algorithm": "HS256",
          "expires": "5m"
        },
        "session": {
          "algorithm": "HS256",
          "expires": "5m"
        }
      }


The weird part is that if I set `token.enable.browser`, `token.enable.request.inbox` and `token.enable.request.outbox` to `false` everything is ok and I can download files.

If somebody had a clue, it would be great.

Thank you.
Marc
Marc
 
Posts: 4
Joined: Thu Feb 23, 2017 8:04 am

Re: 'Donwload As' Error

Postby dsi-lille » Fri Feb 24, 2017 7:44 am

Hello,

Community Server doesn't support the JSON Web Token feature. (See viewtopic.php?f=31&t=9535).
Hope it will be soon !

Yoann.
dsi-lille
 
Posts: 95
Joined: Mon Jul 11, 2016 1:47 pm

Re: 'Donwload As' Error

Postby Maxim » Mon Feb 27, 2017 10:57 am

Community Server will support the JSON Web Token feature in 9.0 release.
Maxim
 
Posts: 777
Joined: Tue Oct 11, 2016 2:34 pm

Re: 'Donwload As' Error

Postby Marc » Mon Feb 27, 2017 12:16 pm

Hello,

thanks for the answers.

Actually I don't use community server.
I just have a Document Server that I use with a custom J2EE application with no Community server involved.

Except the download, the token feature seems OK.

Marc
Marc
 
Posts: 4
Joined: Thu Feb 23, 2017 8:04 am

Re: 'Donwload As' Error

Postby Maxim » Wed Mar 01, 2017 11:33 am

Hello Marc!
Please make sure that there is a field "permissions" in object you want to sign (just like here in test example), if you have that field than send us logs please to find out a problem /var/log/onlyoffice/documentserver/docservice/out.log
Maxim
 
Posts: 777
Joined: Tue Oct 11, 2016 2:34 pm

Re: 'Donwload As' Error

Postby Marc » Wed Mar 01, 2017 5:55 pm

Hello Maxim,

I checked everything.

Here is the JS part in my app :

Code: Select all
     var сonnectEditor = function () {
            docEditor = new DocsAPI.DocEditor("iframeEditor", {
                width: "100%",
                height: "100%",
                type: "desktop",
                documentType: "spreadsheet",
                editorConfig: {"callbackUrl":"http://192.168.0.92:8080/IndexServlet?type=track&data=29217CECDD4A34E6",
                "customization":{"feedback":false,"goback":false,"about":false,"chat":true},
                "user":{"id":2,"lastname":"SUPPORT","firstname":"Tetra"},
                "lang":"fr",
                 "mode":"edit"
                },
                document: {"fileType":"xls","title":"xxxxxxxxxxxxxxx.xls",
                "permissions":{"edit":true,"download":true,"print":true},
                 "key":"d7cef0fc-23fd-4b37-9bf1-4b8f965c9e00","url":"http://192.168.0.92:8080/xxxxxxxxxxxxxxxxxxxx.xls","info":{"author":"Mr.","created":"03/01/2017"}},
                token: "TOKEN",
                events: {
                    "onReady": onReady,
                    "onDocumentStateChange": onDocumentStateChange,
                    'onRequestEditRights': onRequestEditRights,
                    "onError": onError,
                    "onDownloadAs" : onDownloadAs
                }
            });
        };


And the log output when I try to download :

Code: Select all
2017-03-01 17:29:16.208] [WARN] nodeJS - Express server listening on port 8000 in production-linux mode
[2017-03-01 17:43:03.283] [ERROR] nodeJS - Error downloadAs jwt: docId = d7cef0fc-23fd-4b37-9bf1-4b8f965c9e00 access deny


I know it is quite a few but unfortunately, that's all I got.

Thank you for your help
Marc
 
Posts: 4
Joined: Thu Feb 23, 2017 8:04 am

Re: 'Donwload As' Error

Postby Maxim » Thu Mar 02, 2017 9:51 am

Hello Marc!
What about log?
So go to debugger, put your object token (which you hide) into left part. Check "payload" you there must be "permissions" just like here.
According to your info there is no "Permissions", but it should be.
Maxim
 
Posts: 777
Joined: Tue Oct 11, 2016 2:34 pm

Re: 'Donwload As' Error

Postby Marc » Wed Mar 08, 2017 11:03 am

Hi, I need to apologize for that :
The token generation was wrong in our code and the payload was empty.
Fixing the token solve the download bug.

However, it seems that if the payload part in the token is empty ({}) but the token signature is correct, we are able to see, edit and save the file. Is that the normal behaviour ?

Thank you for everything.
Marc
Marc
 
Posts: 4
Joined: Thu Feb 23, 2017 8:04 am


Return to Docker Version

Who is online

Users browsing this forum: No registered users and 4 guests