Question

Using FileApiService externally

Hello! At the moment I'm building a webservice that is supposed to externally upload a file to Creatio using a request to FileApiService. I've analyzed the request that Creatio makes when a file is uploaded via the normal Creatio interface. I've also copied this request into my own webservice and it works there as well.

However, when I copy the whole request it uses the authorization cookie that was created when I logged into Creatio. Ideally, the the webservice should log it self into Creatio and uses it's own authorization cookie. I've followed the documentation and used AuthService.svc to do this, but without success. When I use the cookie created by AuthService.svc, I always get a 401 "Unauthorized" error message. Strangely however, I am able to use this cookie to successfully send OData requests, only the fileupload is not possible.

Any help with this problem would be greatly appreciated.

Like 0

Like

2 comments

Hello Kai,

 

Can you please show how do you authenticate via AuthService.svc and also how do you use the received cookie when sending a file to the system?

 

Thank you!

 

Best regards,

Oscar

Hello Oscar,

 

thank you for your reply, but I've already found the solution to the problem.

 

When using AuthService.svc, the resulting cookie includes the properties "HttpOnly", "secure;" "path=/", and "expires=..." – whereas these properties are apparently not expected when using FileApiService. So, when accessing FileApiService you need to modify the cookie and remove these properties. Then one can use the remaining cookie and the authorization is successful.

 

Kind regards

Kai

Show all comments