Skip to content

Instantly share code, notes, and snippets.

@vibhavsinha
Created December 7, 2016 13:24
Show Gist options
  • Save vibhavsinha/b8755fa2ab846e83258e81775003b051 to your computer and use it in GitHub Desktop.
Save vibhavsinha/b8755fa2ab846e83258e81775003b051 to your computer and use it in GitHub Desktop.
sample code to generate OTP on nodejs
/// this is the backend code. Use the generated OTP in this file to embed videos using embed code as given on
/// https://www.vdocipher.com/page/api.curl
let request = require('request');
var api_url = "https://api.vdocipher.com/v2/";
var secret_key = "API_SECRET_KEY";
function getOtp(v, c) {
request.post({
url: api_url + "otp",
qs: {
video : v
},
form: {
clientSecretKey : secret_key
}
}, function(error, response, body){
if (error){
c(response.statusCode);
return false;
}
if (response.statusCode !== 200) {
c(response.statusCode);
return false;
}
c(null, JSON.parse(body));
});
}
var res = getOtp("VIDEO_ID", function(error, data) {
console.log(data.otp);
});
@yassin-mokni
Copy link

How about the annotation , how can we add it ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment