Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2.  
  3. // Required if your environment does not handle autoloading
  4. require __DIR__ . '/vendor/autoload.php';
  5.  
  6. // Use the REST API Client to make requests to the Twilio REST API
  7. use TwilioRestClient;
  8.  
  9. $id = $_GET['id'];
  10.  
  11.  
  12. // Substitute your Twilio AccountSid and ApiKey details
  13. $accountSid = 'xxx';
  14. $apiKeySid = 'xxx';
  15. $apiKeySecret = 'xxx';
  16.  
  17. // Create an Access Token
  18. $token = new Services_Twilio_AccessToken(
  19. $accountSid,
  20. $apiKeySid,
  21. $apiKeySecret,
  22. $ttl=3600,
  23. $identity='user'.$id
  24. );
  25.  
  26. // Grant access to Conversations
  27. $grant = new Services_Twilio_Auth_ConversationsGrant();
  28. $grant->setConfigurationProfileSid('configurationProfileSid');
  29. $token->addGrant($grant);
  30.  
  31. // Serialize the token as a JWT
  32. echo $token->toJWT();
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement