如何在 twilio 子帐户上创建 api 密钥

How to create an api key on a twilio sub account

所以目前我们在 twilio 上有一个主账户和多个子账户。我们正在尝试实施客户端访问令牌,这些需要(除其他外)一个 api 密钥和一个 api 秘密。

我们已经尝试使用主 api 密钥,但是当我们将它与子帐户上的 twiml 应用程序一起使用时,它 returns 出现身份验证错误(无效令牌)有什么方法可以生成通过 twilio 上的 restful api 的 api 键??

非常感谢

我终于能够联系到 twilio 支持人员,他们非常乐于助人,能够为我提供答案。

use Twilio\Rest\Client;

// Find your Account Sid and Auth Token at twilio.com/console
$sid    = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token  = "your_auth_token";
$twilio = new Client($sid, $token);

$key = $twilio->newKeys->create(array("FriendlyName" => "New Key from PHP"));
print($key->sid . "\n");
print($key->secret . "\n");

对于 nodejs:

const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.newKeys.create({friendlyName: 'New Key from Node.js'})
      .then(key => console.log(key.sid,key.secret));

显然答案尚未添加到文档中。