为什么 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错

阅读 5.6k
3 个回答
axios.post(url, data, {
  headers: {}
})

或者

var instance = axios.create({
  baseURL: 'https://some-domain.com/api/',
  headers: {'X-Custom-Header': 'foobar'}
});

instance.post({data: {}})

谢邀。

首先看到403那就是访问被服务器端拒绝,应该去看下这个API接口的官方文档,对于为什么出现403的说明。
我感觉应该是设置header这块出了问题。 我没有用过这个API,所以无法直接看出具体是哪里的问题,sorry……

{"code":1,"error":{"status":403,"code":119,"error":"该操作已被禁止,请变更应用选项『启用通用的短信验证码服务(开放 requestSmsCode 和 verifySmsCode 接口)』。"}}

clipboard.png

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进