[英]the server responded with a status of 429 (Too Many Requests) intlTelInput.js
[英]RestException [Error]: Too many requests status: 429, code: 20429,
下面的助手 function 是我的助手 function,它做了兩件事。 1.generateotp function 將從 req.body 發送 otp 到手機(這里我傳遞了兩個參數手機號碼和頻道。頻道是發送 otp 表示短信或 otp 這里是短信的模式) 2.secon ZC1C425268E68385D1AB5074C17A94F1Z 將驗證用戶接收的otp . 這里我們也采用 2 參數手機號碼和 otp
var db = require('../config/connection');
const config= require('../config/config');
const collection = require('../config/connection');
const client = require("twilio")(config.accountSID,config.authToken)
module.exports={
generateOtp:(userNumber,channel) => {
client
.verify
.services(config.serviceID)
.verifications
.create({
to:`+91${userNumber}`,
channel:channel
})
.then((data) => {
console.log(data)
// return callback(null, 'success');
})
.catch((error) => {
console.log(error);
});
},
verifyOtp:(userNumber,userOtp) => {
client
.verify
.services(config.serviceID)
.verificationChecks
.create({
to:`+91$${userNumber}`,
code:userOtp
})
.then((data) => {
console.log(data);
})
.catch((error) => {
console.llog(error);
})
}
}
路線
/Generate Otp
router.post('/signup',(req,res) => {
const {userNumber, channel} = req.body;
userhelper.generateOtp(userNumber,channel)
return res.redirect('/verify');
});
//Verify Otp
router.post('/verify',(req,res) => {
const {userNumber,userOtp} = req.body;
console.log(req.body);
// userhelper.verifyOtp(userNumber,userOtp)
})
我正在使用 twilio 驗證 api 進行手機號碼驗證,上面的代碼工作完美,直到昨天現在是測試代碼我收到錯誤。
RestException [Error]: Too many requests
at success (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\twilio\lib\base\Version.js:135:15)
at Promise_then_fulfilled (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:766:44)
at Promise_done_fulfilled (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:835:31)
at Fulfilled_dispatch [as dispatch] (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:1229:9)
at Pending_become_eachMessage_task (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\q\q.js:1369:30)
at RawTask.call (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\asap\asap.js:40:19)
at flush (C:\Users\Alfas Ahmed\Desktop\whatsapp-ecom\node_modules\asap\raw.js:50:29)
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
status: 429,
code: 20429,
moreInfo: 'https://www.twilio.com/docs/errors/20429',
details: undefined
}
如何測試Twilio驗證而不限制速率
上面發生的事情是,在開發時我只是用同一個手機號碼測試了很多次。 Twilio 剛剛阻止了服務。 所以我剛剛創建了新的服務 ID,現在代碼工作得很好。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.