Callback Alfresco 403

Hi,
I have OnlyOffice Version: 8.0.1. Build: 31 installed in docker with the Alfresco connector.
I’m integrating Document Server with my own application on the other hand.

When i open a pdf in the fillforms only mode in my app i need to update the alfresco node with the changes. So i think that i have to add the parameter

editorConfig.callbackUrl=http://blabla/alfresco/s/parashift/onlyoffice/callback?nodeRef=workspace://SpacesStore/nodeid

Otherwise my callbackUrl is empty and the “Complete And Submit” button don’t work.
If i remove editorConfig.callbackUrl all works fine but i can’t use the “complete and submit button” and the filled form remains only in onlyoffice and i have not the values entered in the form saved in my alfresco node content.

But with this callbackurl the document server return an error:

[2024-08-08T09:28:53.792] [ERROR] [localhost] [f07fa5b9-494b-4446-b9f3-df5c3ab87709_1.0] [admin9] nodeJS - postData error: url = http://xxx/alfresco/s/parashift/onlyoffice/callback?nodeRef=workspace://SpacesStore/f07fa5b9-494b-4446-b9f3-df5c3ab87709;data = {“key”:“f07fa5b9-494b-4446-b9f3-df5c3ab87709_1.0”,“status”:4,“actions”:[{“type”:0,“userid”:“admin”}]} Error: Error response: statusCode:403; headers:{“server”:“Apache-Coyote/1.1”,“content-length”:“58”,“date”:“Thu, 08 Aug 2024 09:28:53 GMT”}; body:
{“error”:1, “message”:“Security hash verification failed”}
at Request._callback (/snapshot/server/Common/sources/utils.js)
at Request.callback (/snapshot/server/Common/node_modules/request/request.js:185:22)
at Request.emit (node:events:527:28)
at Request. (/snapshot/server/Common/node_modules/request/request.js:1161:10)
at Request.emit (node:events:527:28)
at IncomingMessage. (/snapshot/server/Common/node_modules/request/request.js:1083:12)
at Object.onceWrapper (node:events:641:28)
at IncomingMessage.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

In the alfresco log i have this

2024-08-08 11:28:53,788 ERROR [com.parashift.onlyoffice.scripts.CallBack] [http-apr-8080-exec-9] Error execution script Callback
java.lang.SecurityException: Security hash verification failed
at com.parashift.onlyoffice.scripts.CallBack.execute(CallBack.java:153)

If i go into the class CallBack.java the error is in this block but i can’t figure out why

            if (username != null) {
                AuthenticationUtil.clearCurrentSecurityContext();
                TenantContextHolder.setTenantDomain((String)AuthenticationUtil.getUserTenant(username).getSecond());
                AuthenticationUtil.setRunAsUser(username);
                NodeRef nodeRef = new NodeRef(request.getParameter("nodeRef"));
                String hash = null;
                if (this.cociService.isCheckedOut(nodeRef)) {
                    hash = (String)this.nodeService.getProperty(this.cociService.getWorkingCopy(nodeRef), Util.EditingHashAspect);
                }

                queryHash = request.getParameter("cb_key");
                if (hash != null && queryHash != null && hash.equals(queryHash)) {
                    Boolean reqNew = this.transactionService.isReadOnly();
                    this.transactionService.getRetryingTransactionHelper().doInTransaction(new ProccessRequestCallback(callBackJSon, nodeRef), reqNew, reqNew);
                    AuthenticationUtil.clearCurrentSecurityContext();
                    break label107;
                }

                throw new SecurityException("Security hash verification failed");
            }

I think that the problem is that i’m not creating and sending the cb_key. But i don’t know how to create it and i can’t find anything on the documentation.

Can you help me please?
Thank You.

Hello @Ghug
The entire scenario of your integration is still unclear to me.
You are opening a file on the side of your app, so I assume that you have implemented the file opening: Opening File - ONLYOFFICE Api Documentation
If so, why are you trying to Save a file back to Alfresco instead of saving it to your app? If you have already integrated the file opening process into your app, saving the file to the same app seems like the correct step.
Please provide us with details about your usage scenario and how exactly you are opening files in the editor and saving them.