I had this issue before, and last time the problem was that node was unpublished. The private file became accessible when the node was published.
This time, however, I'm not using a node. I'm just using Drupals file manage system to store my own files for my own custom module. SO I generated a url for an image file like so:
$imageFile = file_load($userInput['fid']); $style = \Drupal::entityTypeManager()->getStorage('image_style')->load('thumbnail'); $url = $style->buildUrl($imageFile->getFileUri());
If I print out the URL, I get:
But when I access that, i get "access denied".
What am I missing?