This repository was archived by the owner on Nov 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ global class TwilioCapability {
119
119
* @return the newly generated token that is valid for 3600 seconds
120
120
*/
121
121
global String generateToken () {
122
- return generateToken (System . currentTimeMillis () + 3600 );
122
+ return generateToken (3600 );
123
123
}
124
124
125
125
/**
@@ -137,12 +137,11 @@ global class TwilioCapability {
137
137
buildOutgoingScope ();
138
138
Map <String , Object > payload = new Map <String , Object >();
139
139
payload .put (' iss' , this .accountSid );
140
- payload .put (' exp' , String .valueOf (System .currentTimeMillis () + ttl ));
140
+ payload .put (' exp' , String .valueOf (System .currentTimeMillis ()/ 1000 + ttl ));
141
141
payload .put (' scope' , join (this .scopes , ' ' ));
142
142
return jwtEncode (payload , this .authToken );
143
143
}
144
144
145
-
146
145
/* PRIVATE METHODS */
147
146
148
147
/**
@@ -326,4 +325,4 @@ global class TwilioCapability {
326
325
}
327
326
328
327
private class TestOnlyException extends Exception {}
329
- }
328
+ }
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
28
28
public class TwilioRestClient {
29
29
30
30
/** The Constant VERSION. */
31
- private static final String VERSION = ' 3.0' ;
31
+ private static final String VERSION = ' 3.1. 0' ;
32
32
33
33
/** The endpoint. */
34
34
private String endpoint = ' https://api.twilio.com' ;
@@ -524,8 +524,9 @@ public class TwilioRestClient {
524
524
HttpRequest request = buildMethod (method , path , params );
525
525
526
526
request .setHeader (' X-Twilio-Client' , ' salesforce-' + VERSION );
527
- request .setHeader (' User-Agent' , ' twilio-salesforce- ' + VERSION );
527
+ request .setHeader (' User-Agent' , ' twilio-salesforce/ ' + VERSION );
528
528
request .setHeader (' Accept' , ' application/json' );
529
+ request .setHeader (' Accept-Charset' , ' utf-8' );
529
530
530
531
request .setHeader (' Authorization' ,
531
532
' Basic ' + EncodingUtil .base64Encode (Blob .valueOf (this .accountSid + ' :' + this .authToken )));
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ private class Twilio_TestRest {
29
29
final static String authToken = ' 12345678901234567890123456789012' ;
30
30
31
31
static testMethod void testTwilioRestResponse () {
32
- String url = ' http ://api.twilio.com' ;
32
+ String url = ' https ://api.twilio.com' ;
33
33
String queryString = ' a=1&b=2' ;
34
34
String responseText = ' This is a test' ;
35
35
TwilioRestResponse response = new TwilioRestResponse (url + ' ?' + queryString ,responseText ,200 );
You can’t perform that action at this time.
0 commit comments