Asset import from Filemaker fails: suspectedly due to missing cookie
Description
I try to import assets (images) from a Filemaker server. They are available at a public url. The fopen command gives a 401 error. On a testpage however I can access the pictures. Also the import with Feed Me of all other fields works fine.
The request of the first image is always responded with an 302 redirect and a Set-Cookie | X-FMS-Session-Key=… command. All following requests must send the cookie. Otherwise a 401 error is thrown. It’s documented and I tested it.
The cookie is a session cookie, it does need to be saved for later requests.
How can I make Feed me/Guzzle save the cookie returned and use it in all subsequent requests?
The Guzzle code I am using
<?php
return [
'*' => [
'requestOptions' => [
['cookies' => true],
['cookies' => $jar],
],
]
];
The Guzzle documentation states "You must specify the cookies option as a GuzzleHttp\Cookie\CookieJarInterface or false." The Craft CMS Feed Me page however returns an error when adding the variables above the arrow shown above.
$jar = new \GuzzleHttp\Cookie\CookieJar();
$client->request('GET', '/get', ['cookies' => $jar]);
The error from the log
Produkte: filemakerBild - Asset error: https://domain.tld/Streaming_SSL/Additional_1/A639B56246F7F02355A8526F5F23455385FB0DAB606B494A85C3DC7150D0DAEB.jpg?RCType=EmbeddedRCFileProcessor - fopen(https://domain.tld/Streaming_SSL/Additional_1/A639B56246F7F02355A8526F5F23455385FB0DAB606B494A85C3DC7150D0DAEB.jpg?RCType=EmbeddedRCFileProcessor): Failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized .
Steps to reproduce
The image URLs are dynamic and are given after OAuth. I therefore cannot supply image URLs for testing.
Additional info
- Craft version: 4.4.9
- PHP version: 5.1.22
- Database driver & version: mariadb:10.4
- Plugins & versions: Feed Me 5.1.3.1, AsyncQueue 3.1.0
This might help: you can remove the extra security for container downloads.
In Filemaker: You can set the authenticatedStream parameter to 2 to disable the streaming URL security enhancements and allow sharing streaming URLs without explicit authorization.