DMarby / picsum-photos

Lorem Ipsum... but for photos.
https://picsum.photos
MIT License
2.2k stars 152 forks source link

hmac auth #68

Closed benbabics closed 4 years ago

benbabics commented 4 years ago

Big fan of your service picsum.photos... thank you for all you're doing!

Recently I noticed that static images from my database were no longer loading/rendering, but rather bombing out with a 400: GET https://i.picsum.photos/id/200/300/300.jpg 400

At first I figured it was because I was sitting behind a VPN, but upon closer look with the VPN off, it appears that to load static images an hmac param is required, otherwise a text response of Invalid parameters is returned.

Where I'm working in localhost, do I need to generate some sort of hmac token that get appended to all requests? Any help is much appreciated. :)

DMarby commented 4 years ago

Hello!

Just to confirm, are you requesting images from the picsum.photos domain, or using the i.picsum.photos domain directly?

You shouldn't be using (or storing) URLs from the i.picsum.photos domain directly, but rather from picsum.photos, for example: https://picsum.photos/id/200/300/300.jpg

When using the picsum.photos domain you'll be redirected to the correct URL to get the image, and your URLs will keep working, as picsum.photos is kept stable and backwards compatible, since it's the user facing API, while i.picsum.photos is the underlying image processing service, and may change at any given time.

benbabics commented 4 years ago

That worked! Simple pebkac error. :)

I'm not really sure how the URL was changed to the i subdomain in my entries, but simple enough issue to fix. Thanks again, and keep up the good work!