Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 223bc79

Browse files
committed
Removed voice related grant components
1 parent add26ec commit 223bc79

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

rest/access-tokens/sync-example/sync-example.3.x.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ const SyncGrant = AccessToken.SyncGrant;
66
const twilioAccountSid = process.env.TWILIO_ACCOUNT_SID;
77
const twilioApiKey = process.env.TWILIO_API_KEY;
88
const twilioApiSecret = process.env.TWILIO_API_SECRET;
9+
const twilioSyncService = process.env.TWILIO_SYNC_SERVICE_SID;
910

1011
// Used specifically for creating Sync tokens
1112
const identity = 'user';
1213

1314
// Create a "grant" which enables a client to use Sync as a given user
1415
const syncGrant = new SyncGrant({
15-
outgoingApplicationSid: outgoingApplicationSid,
16-
incomingAllow: true, // Optional: add to allow incoming calls
16+
serviceSid: twilioSyncService,
1717
});
1818

1919
// Create an access token which we will sign and return to the client,

rest/access-tokens/sync-example/sync-example.5.x.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ static void Main(string[] args)
1111
const string twilioAccountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
1212
const string twilioApiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY");
1313
const string twilioApiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET");
14+
const string twilioSyncService = Environment.GetEnvironmentVariable("TWILIO_SYNC_SERVICE_SID");
1415

1516
// These are specific to Sync
1617
const string identity = "user";
1718

1819
// Create a Sync grant for this token
1920
var grant = new SyncGrant();
20-
grant.OutgoingApplicationSid = outgoingApplicationSid;
2121

22-
// Optional: add to allow incoming calls
23-
grant.IncomingAllow = true;
22+
// Create a "grant" which enables a client to use Sync as a given user
23+
grant.serviceSid = twilioSyncService;
2424

2525
var grants = new HashSet<IGrant>
2626
{

rest/access-tokens/sync-example/sync-example.5.x.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
$twilioAccountSid = getenv('TWILIO_ACCOUNT_SID');
1010
$twilioApiKey = getenv('TWILIO_API_KEY');
1111
$twilioApiSecret = getenv('TWILIO_API_KEY_SECRET');
12+
$twilioSyncService = getenv("TWILIO_SYNC_SERVICE_SID");
13+
1214

1315
// Required for Sync grant
1416
// An identifier for your app - can be anything you'd like
@@ -25,10 +27,10 @@
2527

2628
// Create Sync grant
2729
$syncGrant = new SyncGrant();
28-
$syncGrant->setOutgoingApplicationSid($outgoingApplicationSid);
2930

30-
// Optional: add to allow incoming calls
31-
$syncGrant->setIncomingAllow(true);
31+
// Create a "grant" which enables a client to use Sync as a given user
32+
$syncGrant->setServiceSid($twilioSyncService);
33+
3234

3335
// Add grant to token
3436
$token->addGrant($syncGrant);

rest/access-tokens/sync-example/sync-example.5.x.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
account_sid = ENV['TWILIO_ACCOUNT_SID']
66
api_key = ENV['TWILIO_API_KEY']
77
api_secret = ENV['TWILIO_API_KEY_SECRET']
8+
twilioSyncService = ENV['TWILIO_SYNC_SERVICE_SID']
9+
810

911
# Required for Sync
1012
outgoing_application_sid = 'APxxxxxxxxxxxx'
@@ -13,8 +15,8 @@
1315
# Create Sync grant for our token
1416
grant = Twilio::JWT::AccessToken::SyncGrant.new
1517

16-
# Optional: add to allow incoming calls
17-
grant.incoming_allow = true
18+
# Create a "grant" which enables a client to use Sync as a given user
19+
grant.serviceSid = twilioSyncService
1820

1921
# Create an Access Token
2022
token = Twilio::JWT::AccessToken.new(

rest/access-tokens/sync-example/sync-example.6.x.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
account_sid = os.environ['TWILIO_ACCOUNT_SID']
88
api_key = os.environ['TWILIO_API_KEY']
99
api_secret = os.environ['TWILIO_API_KEY_SECRET']
10+
twilioSyncService = os.environ[process.env.['TWILIO_SYNC_SERVICE_SID']
1011

1112
# required for Sync grant
1213
identity = 'user'
@@ -16,9 +17,10 @@
1617

1718
# Create a Sync grant and add to token
1819
sync_grant = SyncGrant(
19-
outgoing_application_sid=outgoing_application_sid,
20-
incoming_allow=True, # Optional: add to allow incoming calls
20+
# Create a "grant" which enables a client to use Sync as a given user
21+
serviceSid=twilioSyncService
2122
)
23+
2224
token.add_grant(sync_grant)
2325

2426
# Return token info as JSON

rest/access-tokens/sync-example/sync-example.8.x.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ public static void main(String[] args) {
1010
String twilioAccountSid = System.getenv("TWILIO_ACCOUNT_SID");
1111
String twilioApiKey = System.getenv("TWILIO_API_KEY");
1212
String twilioApiSecret = System.getenv("TWILIO_API_SECRET");
13+
String twilioSyncService = System.getenv("TWILIO_SYNC_SERVICE_SID");
14+
1315

1416
// Required for Sync
1517
String identity = "user";
1618

1719
// Create Sync grant
1820
SyncGrant grant = new SyncGrant();
19-
grant.setOutgoingApplicationSid(outgoingApplicationSid);
2021

21-
// Optional: add to allow incoming calls
22-
grant.setIncomingAllow(true);
23-
22+
// Create a "grant" which enables a client to use Sync as a given user
23+
grant.setServiceSid(twilioSyncService);
24+
2425
// Create access token
2526
AccessToken token = new AccessToken.Builder(
2627
twilioAccountSid,

0 commit comments

Comments
 (0)