Skip to content

Instantly share code, notes, and snippets.

@jagroop
Created July 25, 2018 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagroop/dc53ea6abdf41546ba8217e38887fd98 to your computer and use it in GitHub Desktop.
Save jagroop/dc53ea6abdf41546ba8217e38887fd98 to your computer and use it in GitHub Desktop.
<?php
include '../vendor/autoload.php';
include 'config.php';
include 'randos.php';
log('hdgfjhdgshfjgdhfhds');
use Twilio\Jwt\ClientToken;
// choose a random username for the connecting user
$identity = randomUsername();
$capability = new ClientToken($TWILIO_ACCOUNT_SID, $TWILIO_AUTH_TOKEN);
$capability->allowClientOutgoing($TWILIO_TWIML_APP_SID);
$capability->allowClientIncoming($identity);
$token = $capability->generateToken();
// return serialized token and the user's randomly generated ID
header('Content-Type: application/json');
// echo json_encode(array(
// 'identity' => $identity,
// 'token' => $token,
// ));
echo $token;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment