我正在尝试使用Firebase函数中的Google Cloud Compute Engine REST API。然而,我被如何开始卡住了,因为我不知道如何从Cloud Functions进行身份验证。
This是我找到的唯一资源,但我不知道如何让它在云函数上工作。
发布于 2019-08-26 07:46:24
我想通了。以下是如何从云函数发送REST API调用:
const {auth} = require('google-auth-library');
const client = await auth.getClient({
scopes: 'https://www.googleapis.com/auth/cloud-platform'
});
var url = [REQUEST URL HERE]
var data = {[REQUEST BODY HERE]}
response = await client.request({
url: url,
method: 'post',
data: data
})https://stackoverflow.com/questions/57649775
复制相似问题