将google云与firebase功能集成
在node.js上集成google云时,如下所述: 其中应包含一个json文件,其中包含机密凭据和密钥:将google云与firebase功能集成,firebase,google-cloud-platform,google-cloud-functions,google-cloud-storage,Firebase,Google Cloud Platform,Google Cloud Functions,Google Cloud Storage,在node.js上集成google云时,如下所述: 其中应包含一个json文件,其中包含机密凭据和密钥: var config = { projectId: 'grape-spaceship-123', keyFilename: '/path/to/keyfile.json' }; 当使用firebase函数/google云函数时,如何才能做到这一点?云函数已经作为受信任的云帐户运行。在大多数情况下,您不需要添加凭证JSON文件。例如,这是: 如您所见,我们没有传递任何授权信息,但代码
var config = {
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
};
当使用firebase函数/google云函数时,如何才能做到这一点?云函数已经作为受信任的云帐户运行。在大多数情况下,您不需要添加凭证JSON文件。例如,这是: 如您所见,我们没有传递任何授权信息,但代码仍然能够访问云存储:
const file = gcs.bucket('YOUR_FIREBASE_PROJECT_ID.appspot.com').file(filePath);
如果您有需要凭据文件的情况:
keyFilename:'./keyfile.json'
const file = gcs.bucket('YOUR_FIREBASE_PROJECT_ID.appspot.com').file(filePath);