New Forum system requires email address which you used to apply for your account to replace your original username. Password stays the same.Please see this post for more details
http://forum.yealink.com/forum/showthread.php?tid=40344

Yealink Test Club has been officially launched. Please visit post below to get detail information. Come and join us!
http://forum.yealink.com/forum/announcements.php?aid=18

We just had the YMCS online and we are also working on the features plan on the future versions, in this regard we are need to hear your voice about the YMCS.
Please visit : http://forum.yealink.com/forum/showthread.php?tid=42322


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RPS API - Authentication Error
Author Message
bmueller Offline
Junior Member
**

Posts: 1
Joined: Jan 2019
Reputation: 0
Post: #4
RE: RPS API - Authentication Error
(11-22-2019 12:08 AM)jrmende5 Wrote:  Good day.

I am working on connecting to the RPS API using the new version (REST server using Access Key and Access Key Secret) from POSTMAN.

But I receive the error: 401 - signature.invalid

I attach the code in postman (Pre-request script):

function getTimestp(){
dt = new Date();
return dt.getTime();
}

function getNonce(){
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4();
}


xkey = "AccessKey";
xsecret = "SecretKey";
xtimest = getTimestp();
xnonce = getNonce();

xheaders = "X-Ca-Key:"+xkey+"\n"+"X-Ca-Nonce:"+xnonce+"\n"+"X-Ca-Timestamp:"+xtimest;

param = pm.request.body.formdata;
dp = Object.values(param);
lg = dp[0];

stparam = "";

for(i=0;i<lg.length;i++){
aPam = lg[i];

equal = "=";
if(aPam["value"] === ""){
equal = "";
}

if(i+1 == lg.length){
stparam += aPam["key"]+equal+aPam["value"];
}else{
stparam += aPam["key"]+equal+aPam["value"]+"&";
}
}


stringToSign = "POST\n"+xheaders+"\n"+pm.request.url.getPath()+"\n"+stparam;

signatureutf8 = CryptoJS.enc.Utf8.parse(stringToSign);
secretByteArray = CryptoJS.enc.Utf8.parse(xsecret);
signatureBytes = CryptoJS.HmacSHA256(signatureutf8,secretByteArray);
requestSignatureBase64String = CryptoJS.enc.Base64.stringify(signatureBytes);

pm.environment.set("signature",requestSignatureBase64String);

Did you ever get this solved? I am having the same issues...
01-06-2020 02:35 PM
Find all posts by this user    like0    dislike0 Quote this message in a reply
Post Reply 


Messages In This Thread
RPS API - Authentication Error - jrmende5 - 11-22-2019, 12:08 AM
RE: RPS API - Authentication Error - bmueller - 01-06-2020 02:35 PM

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Autoprovisionong T4xS v83 error gasper_s 2 1,287 11-05-2018 10:25 AM
Last Post: gasper_s
  T32G Auto provisioning error with encryption Mike89 0 1,308 09-18-2017 12:47 AM
Last Post: Mike89
  Upgrade firmware error from tftp boot server guillosur 1 3,258 05-05-2016 06:18 AM
Last Post: Karl_Yealink
  HTTPS/SSL Error nickcoons 18 32,059 02-28-2016 10:17 AM
Last Post: Novum Networks
  Incorrect File Format error on call send, receive or end call morrism 4 6,246 10-06-2015 07:37 AM
Last Post: morrism
  Auto Provisioning error AndyInNYC 1 5,837 09-10-2014 10:19 AM
Last Post: Wilson_Yealink

Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us   Yealink   Return to Top   Return to Content   Lite (Archive) Mode   RSS Syndication