I need to load images that required basic authentication. I am using SDWebImage. I have a directory that is open to the public and those images load correctly. When I try and load images from a directory that requires authentication, it never loads the image. Is it possible to pass a username and password for authentication? I have added the following code, but it doesn't appear to help:
SDWebImageManager.SharedManager.ImageDownloader.Username = "myusername";
SDWebImageManager.SharedManager.ImageDownloader.Password = "mypassword";
ivPic.SetImage(
url: new NSUrl("https://www.example.com/secure/pic.jpg"),
placeholder: UIImage.FromBundle("NotAvailable.jpg")
);
EDIT: I have now become desperate as I cannot seem to access the images in an authentication required folder no matter what. I found a link using a different package (FFImageLoading) that gives an example here, but I am not using a token only a username and password via Basic Authentication. How can I get what the '_authService.GetToken' is?
ImageService.Initialize(new Configuration { HttpClient = new HttpClient(new AuthenticatedHttpImageClientHandler(_authService.GetToken)) });