403-forbidden - 为什么 LeanCloud 发送短信验证码时报 403 错
本文介绍了403-forbidden - 为什么 LeanCloud 发送短信验证码时报 403 错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
这个问题如何解决哈,在线等
Axios.post(
"https://api.leancloud.cn/1.1/requestSmsCode",
{
mobilePhoneNumber : '15209893158',
name : "快乐星猫",
smsType:'sms'
},
{
headers : {
"X-LC-Id" : "xxxxxx",
"X-LC-Key" : "xxxxx"
},
}
).then(function(response){
console.log(response);
}).catch(function (error) {
console.log(error);
});
Axios.post(
"https://api.leancloud.cn/1.1/requestSmsCode",
{
},
{
data:{
mobilePhoneNumber : '15209893158',
name : "快乐星猫"
},
headers : {
"X-LC-Id" : "xxxxx",
"X-LC-Key" : "xxxxx",
"Content-Type": "application/json"
},
}
).then(function(response){
console.log(response);
}).catch(function (error) {
console.log(error);
});
这两种写法都报403错
解决方案
axios.post(url, data, {
headers: {}
})
或者
var instance = axios.create({
baseURL: 'https://some-domain.com/api/',
headers: {'X-Custom-Header': 'foobar'}
});
instance.post({data: {}})
这篇关于403-forbidden - 为什么 LeanCloud 发送短信验证码时报 403 错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文