request is forbidden!

用户5952754
2021-12-28 07:04 60 1

使用的sdk中的方法出现的问题:“request is forbidden! Maybe your appkey is listed in blacklist or your params is invalid”

private SMSClient client = null;
    private static SmsSender sInstance;


    public static SmsSender getInstance(String masterSecret, String appkey) {
        if (sInstance == null) {
            synchronized (SmsSender.class) {
                sInstance = new SmsSender(masterSecret, appkey);

            }
        }
        return sInstance;
    }

    public SmsSender(String masterSecret, String appkey) {
        this.client = new SMSClient(masterSecret, appkey);
    }

    public boolean sendSms(String tel, String code) {
        SMSPayload payload = SMSPayload.newBuilder()
                .setMobileNumber(tel)
                .setTempId(1)
                .setCode(code)
                .build();
        try {
            SendSMSResult res = client.sendSMSCode(payload);
            return res.isResultOK();
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }


    }
}

1个回答

热门排序
gptbots-widget