Monday, 13 March 2017

Use firebase hosting to limit download to authenticated users

I'm attempting to use firebase hosting to limit the download of a file (any file in a specific folder really) only to authenticated users. I've solved the problem for myself with a node server by following the firebase docs and writing a fireBaseAuth middleware, integrating with firebase storage, using google cloud storage, etc.

In order to deploy all this to firebase it looks like I would have to

  1. Setup firebase hosting with all my static files
  2. Upload the 'secure' files to firebase storage (what I'm doing now)
  3. Use firebase functions to parse request cookies and pluck files out of storage for authenticated users (what I'm doing with an express server now)

It seems like there should be a simpler solution for locking down routes within hosting - Am I missing something?

What I think should be possible:

  1. Upload all files to firebase hosting, including 'secure' files
  2. Tell firebase to only serve 'secure' files to authenticated users, maybe with a glob pattern
  3. Go home early...

Any ideas? If I'm not missing something and you're on the firebase team, then this is a feature request.



via Alan L.

No comments:

Post a Comment