0

I'm using the Vision Api Product Search in the Google CLoud Vision, so i want to access the images in the firebase Storage but now when i'm making request this error occurs "message": "Error opening file: gs://swaepone.appspot.com/bag.jpeg." so how to have read access to the firebase sotrage ?

Flutter Dev
  • 488
  • 3
  • 18
  • Does this answer your question? [User does not have permission to access this object . Firebase storage android](https://stackoverflow.com/questions/38671444/user-does-not-have-permission-to-access-this-object-firebase-storage-android) – Martin Zeitler Jun 12 '22 at 12:41
  • @MartinZeitler i tried to make my bucket public but also the error still exists, i don't know why ! – Flutter Dev Jun 12 '22 at 12:43
  • No need to make it public - a service account might be authenticated. It's the same bucket as it can be found here: https://console.cloud.google.com/storage – Martin Zeitler Jun 12 '22 at 12:44
  • @MartinZeitler Deal but why i'm getting this error ? – Flutter Dev Jun 12 '22 at 12:49

2 Answers2

2

Assuming this is the service account calling ...check the bucket permissions on Cloud Storage.

PROJECT_ID.appspot.com is the the relevant GCS bucket, behind "Firebase Storage".

The security rules for Firebase Storage might only consider Firebase Auth users;
you'd have to add this service account with (at least) role "Storage Object Viewer".

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • thanks for your response, i'm trying to authenticate with an Api key not with service account and in the documentation it's mentioned that the bucket must be public, and i'm making my bucket public but still error exist also. – Flutter Dev Jun 12 '22 at 17:04
0

When i made the bucket public to all users and add the role 'Storage Object Viewer' the error gone! but my question is, is it a bad way to make the bucket public and the users can now modify or delete any data ? or only can view them Image

Flutter Dev
  • 488
  • 3
  • 18
  • There's no need to make it public when the service account can access objects. – Martin Zeitler Jun 14 '22 at 01:38
  • @MartinZeitler i'm not authenticating with service account while with an api key, because i didn't understand how to authenticate with service account with the http request from the flutter mobile app – Flutter Dev Jun 14 '22 at 07:09