I have a cordova app running on android with a spring boot backend. In the app the client can upload a photo. At the moment the file is uploaded to google cloud storage via the backend, who has a service credentials file. When we want to display a photo in the app should the photo be read from google cloud platform via the spring boot app? Or can we read directly from the google cloud bucket, (in this case how do we authenticate)?
2
votes
1 Answers
1
votes
I would say it's simplest to read the data from GCS in the Java code, and then serve the data from your application.
An alternative you could consider is to generate a signed URL in your backend; the client can then use that signed URL to fetch the data. The Google Cloud Storage client library should make generating the signed URL fairly straightforward. You'll want to regenerate each time the client loads a page of photos though, as signed URLs (deliberately) have a limited lifespan.