【问题标题】:Generating Twillio video token with my php server使用我的 php 服务器生成 Twilio 视频令牌
【发布时间】:2017-03-31 02:55:16
【问题描述】:

我正在尝试设置我自己的 php accessToken 服务器,以便在我的 ios swift 应用程序上为不同用户授予新令牌。

我已经设置好了,并且可以获取令牌密钥,但是当 videoQuickStart 应用程序使用从我的服务器获取的令牌密钥时,它不会连接到房间,即使我尝试使用“令牌。 php" 从这里:https://github.com/TwilioDevEd/video-quickstart-php/blob/master/token.php 它仍然无法正常工作。

我的密钥好像没有经过验证?

谁能帮忙?

这是我的服务器实现,和原来的几乎一模一样。

< ? php
include('/Applications/XAMPP/xamppfiles/htdocs/dashboard/vendor/autoload.php');

use Twilio\Jwt\AccessToken;

use Twilio\Jwt\Grants\VideoGrant;


// Required for all Twilio access tokens

$TWILIO_ACCOUNT_SID = 'XXXXX';

$TWILIO_CONFIGURATION_SID = 'XXXX';

$TWILIO_API_KEY = 'XXXX';

$TWILIO_API_SECRET = 'XXXXX';


// An identifier for your app - can be anything you'd like

$identity = $_GET['name'];

// Create access token, which we will serialize and send to the client

$token = new AccessToken(
$TWILIO_ACCOUNT_SID, 
$TWILIO_API_KEY, 
$TWILIO_API_SECRET, 
3600, 
$identity
);




$grant = new VideoGrant();

$grant->setConfigurationProfileSid($TWILIO_CONFIGURATION_SID);

$token->addGrant($grant);


// render token to string

echo json_encode(array(
'identity' => $identity,
'token' => $token->toJWT(),
));
?>

【问题讨论】:

  • “我的密钥似乎没有经过验证”我想与 Twilio 交谈是最好的解决方案?
  • 谢谢,会试试的。

标签: php video token


【解决方案1】:

已经解决了。

原来我放错了 TWILIO_ACCOUNT_SID 和 TWILIO_CONFIGURATION_SID。

谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-02
    相关资源
    最近更新 更多