Reputation: 43
Firebase hosting my website. Website has a <iframe>
element, it will load aaa.html
from bucket in google cloud storage.
<iframe src="https://storage.googleapis.com/bucket/aaa.html" />
And aaa.html
will also load other files (js
files or img
files) stored in the same bucket.
When I use gsutil iam ch allUsers:objectViewer gs://bucket
to set bucket public and all files public, website works perfectly. But I do not want that users could link aaa.html
without my website. Set bucket public is seems to be incorrect.
So, is there a way to make bucket public to a specific website?
Upvotes: 1
Views: 1305
Reputation: 1428
Ok. You mentioned you don't want to make your bucket public. Singed URLs are not for you.
I think you can achieve your goal by doing the following:
Define a service account with the roles and permissions you need to get the stored objects in your bucket. This service account will be used by your application.
Use the GCS API to get into the stored files in your bucket. Here is how to Use a service account to call an API in your code
Hope this is helpful :D
Upvotes: 1