Created
December 7, 2016 13:24
-
-
Save vibhavsinha/b8755fa2ab846e83258e81775003b051 to your computer and use it in GitHub Desktop.
sample code to generate OTP on nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about the annotation , how can we add it ?
Thanks