android – How to upload images with Picasso from a PHP session?

I'm trying to upload images with Picasso. The images are only accessible to connected users.

PHP code:

$ imginfo = getimagesize ($ this-> url);
header ("content type: {$ imginfo['mime']} ");

$ type = image / jpeg & # 39;
header (& # 39; Content-Type: & # 39 ;. $ type);
header (& # 39; Content-Length: & # 39;. file size ($ this-> url));
readfile ($ this-> url);

Trying to load the images causes an error: HTTP 504

The reason is that Picasso does not use the same cookie shop as Volley.

In the first activity of my application, I use this code:

val cookieManager = CookieManager ()
cookieManager.setCookiePolicy (ACCEPT_ALL)
CookieHandler.setDefault (cookieManager)

How can I tell Picasso to use this cookie shop so that he submits the session cookie when he tries to load an image?