How to Protect Cloudflare R2 Resources With Firebase App Check

https://hackernoon.imgix.net/images/jDpmEvX2s9NOjteuQqYzwKALIDn2-sh922lr.png

Towards the end of the year I like to work on my festive app, Christmas Chill, a collection of looped videos that mimic the burning log fire channels you used to see on TV. This year I’m bringing it to Android and moving the videos to the cloud, so I can update them remotely and avoid bloating the app size.

To know which videos are available, the app downloads a JSON catalog of video URLs on start. The catalog and videos live in a Cloudflare R2 bucket behind a public custom domain.

That’s problematic because a public domain is available to everyone. Anyone can query the catalog JSON, read every video URL inside, and download the entire list without ever installing the app. I wanted to change that so only genuine app installs can fetch the catalog and find out where the videos are hosted.

This post covers how...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE