Hi,
I am writing a script calling the EFI FIery . I can login and get authentificated but as soon as I try to upload a file, I get rejected by the server (teh user is not authentificated). I think some token/cookie isn't properly stored.
Does Switch generates such cookies ?
Really lost here.
TIA for any help.
Loic
HTTP authentification issue
Re: HTTP authentification issue
It depends on their authentication scheme. Sometimes, on success of authentication, it would provide an access token on the response that you could use on further requests. Switch probably can't save and reference cookies.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Free Switch apps: open-automation @ Enfocus appstore
Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Re: HTTP authentification issue
Hi Gabriel,
Yes that's probably the key here. Problem is the Fiery API response on login doesn't expose much. We saw some cookie settings but none of our attemps to use it has worked yet.
We will keep on trying tomorrow
Thanks anyway for your interest and care here and elsewhere
Yes that's probably the key here. Problem is the Fiery API response on login doesn't expose much. We saw some cookie settings but none of our attemps to use it has worked yet.
We will keep on trying tomorrow
Thanks anyway for your interest and care here and elsewhere
Re: HTTP authentification issue
Hi jan,
Thanks for entering in. Actually I did use Postman which helped a lot. I identified the issue but still not able to make it work.
Postman will keep the cookie from login call in memory. It then passes it again to the upload call and it all works fine.
The problem is that Switch doesn't keep the cookie in memory so I have to pass it on to the next http call. But this is where I failed.
Has any of you ever passed a cookie in some http call ?
None of these worked :\
//where theCookie is the token returned by the login call
theHTTP.addHeader ( "cookie", theCookie );
theHTTP.addHeader ( "Cookie", theCookie );
theHTTP.addHeader ( "Set-Cookie", theCookie );
theHTTP.addHeader ( "set-cookie", theCookie );
Thanks for entering in. Actually I did use Postman which helped a lot. I identified the issue but still not able to make it work.
Postman will keep the cookie from login call in memory. It then passes it again to the upload call and it all works fine.
The problem is that Switch doesn't keep the cookie in memory so I have to pass it on to the next http call. But this is where I failed.
Has any of you ever passed a cookie in some http call ?
None of these worked :\
//where theCookie is the token returned by the login call
theHTTP.addHeader ( "cookie", theCookie );
theHTTP.addHeader ( "Cookie", theCookie );
theHTTP.addHeader ( "Set-Cookie", theCookie );
theHTTP.addHeader ( "set-cookie", theCookie );
Re: HTTP authentification issue
There is a property, localFilePath : String that can store responses from the server as a file. Maybe that can be used to store the Cookie and read from it.
Jan
Jan
Re: HTTP authentification issue
Hi Jan,
Thanks for the input. Actually I could get the cookie string but I can't get to pass it to the next request.
Loic
Thanks for the input. Actually I could get the cookie string but I can't get to pass it to the next request.
Loic
Re: HTTP authentification issue
HI all,
I think I found the problem. It seems (unless I am wrong) that Switch always close the connection once it did the http(s) call. In my case, the connection needs to remain open.
I tried to set headers so the connection keeps alive but it seems to be effectless. I got in touch with support and am waiting for their feedback.
FWIW
Loic
I think I found the problem. It seems (unless I am wrong) that Switch always close the connection once it did the http(s) call. In my case, the connection needs to remain open.
I tried to set headers so the connection keeps alive but it seems to be effectless. I got in touch with support and am waiting for their feedback.
FWIW
Loic