I am using react native, and want to upload image to gcp storage I am not using any app engine. According to gcp documentation for node
const Storage = require('@google-cloud/storage');
const storage = Storage({
projectId: 'id',
keyFilename: 'private-key'
});
const bucketName = 'buckt';
// Uploads a local file to the bucket
storage
.bucket(bucketName)
.upload('filename')
.then(() => {
console.log(`${filename} uploaded to ${bucketName}.`);
})
.catch(err => {
console.error('ERROR:', err);
});
To use this code in client, I need to pass private key which I don't want to do
According to this blog post https://medium.com/google-cloud/uploading-resizing-and-serving-images-with-google-cloud-platform-ca9631a2c556 , there is a get_serving_url() function in google app engine.
I reckon for Google Push notifications, google provides each client token so that client directly communicates with server
Is there any way where I can upload image directly from client?