ONLYOFFICE / onlyoffice-owncloud

The app which enables the users to edit office documents from ownCloud using ONLYOFFICE Document Server, allows multiple users to collaborate in real time and to save back those changes to ownCloud
Apache License 2.0
302 stars 91 forks source link

Error when trying to connect (Error occurred in the document service: Invalid token) #193

Closed pixel75 closed 6 years ago

pixel75 commented 6 years ago

when I try to integrate Onwcloud to Onlyoffice I receive this error back: Error when trying to connect (Error occurred in the document service: Invalid token)

which should be the issue?

regards,

alexanderonlyoffice commented 6 years ago

Hello @pixel75,

Please specify OS of the server where Document Server is installed and its installation type (Docker or DEB/RPM).

It seems that the problem is in JWT, but we need to know your OS and installation type to tell you where to find required configs.

Send us also a screenshot of ONLYOFFICE address settings in Owncloud.

pixel75 commented 6 years ago

Thanks for the reply.

Owncloud :Linux owncloud 3.16.0-6-amd64 #1 SMP Debian 3.16.56-1+deb8u1 (2018-05-08) x86_64 GNU/Linux

Onlyoffice: Linux onlyoffice 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

On onlyoffice default.json I change:

"secret": { "browser": { "string": "SECRET", "file": "", "tenants": {} }, "inbox": { "string": "SECRET", "file": "", "tenants": {} }, "outbox": { "string": "SECRET", "file": "" }, "session": { "string": "SECRET", "file": "" } }, "token": { "enable": { "browser": true, "request": { "inbox": true, "outbox": true } },

attached both onlyoffice DS & OC settings thanks,

onlyoffice owncloud

alexanderonlyoffice commented 6 years ago

@pixel75, check also JWT header in default.json in the section below:

"inbox": {
          "header": "****",
          "prefix": "Bearer ",
          "inBody": false
        },
        "outbox": {
          "header": "****",
          "prefix": "Bearer ",
          "algorithm": "HS256",
          "expires": "5m",
          "inBody": false

Try to add the following section to the config.php file of your Owncloud:

'onlyoffice' =>
  array (
    "jwt_secret" => "****",
    "jwt_header" => "****"
    )

Where under **** in "jwt_secret" => string is your secret and in "jwt_header" => string is JWT header from default.json.

pixel75 commented 6 years ago

Thanks, now I've got this: "CommandRequest on check error: Error occurred in the document service: Error while downloading the document file to be converted."

This is the log on OC: {"reqId":"YZuxSGov2GqAhydJNAIY","level":1,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"admin","app":"onlyoffice","method":"PUT","url":"\/index.php\/apps\/onlyoffice\/ajax\/settings","message":"SetDocumentServerUrl: https:\/\/onlyoffice..eu\/"} {"reqId":"YZuxSGov2GqAhydJNAIY","level":1,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"admin","app":"onlyoffice","method":"PUT","url":"\/index.php\/apps\/onlyoffice\/ajax\/settings","message":"SetDocumentServerInternalUrl: https:\/\/onlyoffice..eu\/"} {"reqId":"YZuxSGov2GqAhydJNAIY","level":1,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"admin","app":"onlyoffice","method":"PUT","url":"\/index.php\/apps\/onlyoffice\/ajax\/settings","message":"SetStorageUrl: "} {"reqId":"YZuxSGov2GqAhydJNAIY","level":1,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"admin","app":"onlyoffice","method":"PUT","url":"\/index.php\/apps\/onlyoffice\/ajax\/settings","message":"Set secret key"} {"reqId":"YZuxSGov2GqAhydJNAIY","level":0,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"admin","app":"onlyoffice","method":"PUT","url":"\/index.php\/apps\/onlyoffice\/ajax\/settings","message":"CommandRequest on check: {\"error\":0,\"version\":\"5.1.4.22\"}"} {"reqId":"K0eLtDwZvFzVMUvH0HIL","level":0,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty"} {"reqId":"K0eLtDwZvFzVMUvH0HIL","level":1,"time":"June 27, 2018 15:33:18","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty with invalid jwt: Cannot handle token prior to 2018-06-27T15:33:21+0000"} {"reqId":"SSS1g4xMbKIzFD7vKaQH","level":0,"time":"June 27, 2018 15:33:19","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty"} {"reqId":"SSS1g4xMbKIzFD7vKaQH","level":1,"time":"June 27, 2018 15:33:19","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty with invalid jwt: Cannot handle token prior to 2018-06-27T15:33:22+0000"} {"reqId":"6mpKDgdNfENfIHqPcWsM","level":0,"time":"June 27, 2018 15:33:21","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty"} {"reqId":"6mpKDgdNfENfIHqPcWsM","level":1,"time":"June 27, 2018 15:33:21","remoteAddr":"proxy","user":"--","app":"onlyoffice","method":"GET","url":"\/index.php\/apps\/onlyoffice\/empty?doc=SGloTVgxME1kVVlvZkJ0cGUxbkFZUmptZW15ZXAyN0pndG9kM2lzYnZkYz0\/eyJhY3Rpb24iOiJlbXB0eSJ9","message":"Download empty with invalid jwt: Cannot handle token prior to 2018-06-27T15:33:23+0000"}

pixel75 commented 6 years ago

Fixed using ntpd in both the servers.

anyway I've got an error opening the files : Mixed Content: The page at 'https://xxxxxxxxxxx/apps/onlyoffice/92205' was loaded over HTTPS, but requested an insecure resource 'http://xxxxxxxxxxx/2018-05-22-13-26/web-apps/apps/documenteditor/main/index.html?_dc=2018-05-22-13-26&lang=it&customer=ONLYOFFICE&frameEditorId=iframeEditor'. This request has been blocked; the content must be served over HTTPS.

may be Ngnix config mistake?

pixel75 commented 6 years ago

Fixed. the issue was on ngnix proxy setup, now I can create, edit Docx, xls, pptx. thank you @alexanderonlyoffice

Login-out commented 1 year ago

@pixel75 I have the same problem, how is your nginx setup

sta-zot commented 7 months ago

@pixel75 I have the same problem, how is your nginx setup.

pixel75 commented 7 months ago

@sta-zot I'm behind an HA proxy so not easy to show my conf.

HA issue the ssl and proxy to the OO in http.

which is your configuration?